Thank, lilbyrdie. It helped me a lot :)

The thing is I'm still getting an error in function
obtainStyledAttributes, where the compiler says that
obtainStyledAttributes(int[]) is undefined.
I have that class extending BaseAdapter. What am I missing? Should I
be implementing an Interface or something?

Thanks!
Yaiza.


On 13 mayo, 20:27, lilbyrdie <kf6...@gmail.com> 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.
>
> On May 12, 12:43 pm, lilbyrdie <kf6...@gmail.com> wrote:
>
> > Hello,
>
> > I'm trying to find the "correct" new way to do imageGalleryitems,
> > previously (as also documented 
> > here:http://developer.android.com/guide/tutorials/views/hello-gallery.html
> > and herehttp://developer.android.com/reference/android/widget/Gallery.html)
> > the correct way was to apply
> > android.R.styleable.Theme_galleryItemBackground.
>
> > Of course, this has been removed (see 
> > here:http://groups.google.com/group/android-developers/browse_thread/threa...)
> > even though theGalleryassumes it will be used (see aboveGallery
> > documentation).
>
> > The net effect is that, without this, agallerywith images looks
> > pretty bad. I could copy out all of the values and resources to
> > recreate the default look, or use reflection to get at styleable, but
> > none of that seems like a particularly workable solution.
>
> > Thoughts? What am I missing?

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