On Sunday, September 11, 2011 8:00:56 PM UTC+8, Jean-Michel wrote:
>
> Hi there, 
> I am trying to implement my own custom drawable to draw triangles 
> (this is an example) by extending ShapeDrawable. 
> Writing the component was OK. 
> Using the component in the code is OK. 
>
> I cam to a brick wall when trying to use the drawable only in XML. 
>
> Example of myDrawable.xml: 
> <com.mycompany.myproject.MyShapeDrawable> 
>     <stroke android:width="1dp" android:color="#FFFFFFFF"/> 
>     <solid android:color="#00000000" /> 
> </ com.mycompany.myproject.MyShapeDrawable> 
>
> I have been crawling the web all day about this and it seems that this 
> cannot be done. 
>
> It is actually not possible ? (The code seem to tell it is not) 
>
> If it cannot be done this is disapointing as it almost defeat the 
> purpose of drawable outside what is provided by Google. 
> Furthermore, it is does not seem so massively complicated. 
> Looking at Drawable.createFromXmlInner(Resources r, XmlPullParser 
> parser, AttributeSet attrs), it feels fairly easy to use introspection 
> and check that "name" is or not a class from the project that extends 
> Drawable. 
>
> The same idea could be extended to ShapeDrawable when the name of the 
> shape in unknown. 
>
> Thanks for your help anyway. 
>
> Jean-Michel 
>

I have created a project in google named ADET that could let you define 
your custom XML drawable. the project address is: 
https://code.google.com/p/adet/ 
with this project, one can define custom XML drawable and use it as a 
NATIVE drawable in anywhere, such as direct used for ImageView's src 
attribute or others
 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to