On Monday, September 12, 2011 3:18:24 PM UTC+8, Romain Guy (Google) wrote: > > Hi, > > Custom drawables are not allowed from XML, mostly for security reasons. > XML drawables can be loaded as resources by other processes (including > Launcher or the system process) and it would be a terrible idea to run > random 3rd party code in these processes. > > On Sun, Sep 11, 2011 at 5:00 AM, Jean-Michel > <[email protected]<javascript:> > > 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 >> >> -- >> 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]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > > > -- > Romain Guy > Android framework engineer > [email protected] <javascript:> > > I have created a project named ADET, which could define custom XML drawable and use it as a NATIVE drawable, the project address is : https://code.google.com/p/adet/
-- 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

