I am attempting to create a drawable in xml using a Drawable subclass (in this case LayerDrawable) to use as a background in a View, but the drawable does not calculate and display its layers the way I had intended. With help from this forum I have found the particular lines of source code that are causing my issue and feel I can very easily create a subclass or change the code or to do what I want.
My question is, assuming I make a new class with no unintended side-effects and I will never need access the old functionality, is it possible to use the new Drawable with the original Drawable‘s xml tag structure (ex. layer-list) to create my updated drawable in the same way?
For example, replace:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/resource_name"
android:drawable=drawable/drawable_resource" />
</layer-list>
with this:
<?xml version="1.0" encoding="utf-8"?>
<package.MyLayerDrawable xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/resource_name"
android:drawable=drawable/drawable_resource" />
</package.MyLayerDrawable>
Very unfortunately, instead of properly sandboxing custom drawables they decided to completely disallow it.
http://groups.google.com/group/android-developers/browse_thread/thread/825a5d8b401d3332