On 13 mayo, 20:27, lilbyrdie <[email protected]> wrote:
> I've answered my own question. Net result is the same, just a
> different way of getting to the default theme resources, but it's what
> I was missing.
>
> Within your attrs.xml file, place a block that looks like the
> following:
>
>     <declare-styleable name="default_gallery">
>         <attr name="android:galleryItemBackground" />
>     </declare-styleable>
>
> This basically provides access to the galleryItemBackground in the
> same way as before, but explicitly making it a styleable now.
>
> This is now used as before:
>
> Within the ImageUriAdapter(), load the background:
>                         TypedArray a = 
> obtainStyledAttributes(R.styleable.default_gallery);
>                         mGalleryItemBackground = a.getResourceId(
>                                         
> R.styleable.default_gallery_android_galleryItemBackground, 0);
>                         a.recycle();
>
> Then, within the getView(), apply the background:
>
>                         
> imageView.setBackgroundResource(mGalleryItemBackground);
>
> I hope this helps someone.

Thanks, lilbyrdie! It helped me a lot :)

What I don't undersstand is why the compiler tells me that the
function obtainStyledAttributes(int[]) doesn't exist. Do I have to
implement an interface or something? I have imported the
android.content.res.Resources.Theme class, but it doesn't care.

What am I missing? :-S

--~--~---------~--~----~------------~-------~--~----~
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