Just wondering why there is so much complexity involved in getting the
platform Gallery background.  The SDK provides a theme that contains
an attribute that is a drawable resource.   The theme is not a
drawable so it can't be used in a layout as a background.  The example
given is - 
http://developer.android.com/resources/tutorials/views/hello-gallery.html
- with these steps -

        TypedArray a =
obtainStyledAttributes(R.styleable.HelloGallery);
        mGalleryItemBackground = a.getResourceId(
 
R.styleable.HelloGallery_android_galleryItemBackground, 0);
        a.recycle();
        setBackgroundResource(mGalleryItemBackground);

where HelloGallery is a Them that includes the platform Theme
attribute that is the actual drawable  -

<resources>
    <declare-styleable name="HelloGallery">
        <attr name="android:galleryItemBackground" />
    </declare-styleable>
</resources>

All you really want is drawable/gallery_item_background.xml.
Unfortunately the very useful Gallery widget doesn't have default
focus behavior unless you do all this.

What is the benefit and/or rationale for all these layers?



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

Reply via email to