Hi all,

I tried asking in the IRC to avoid making noise here, but noone has answered me.

I can't understand or realize what's happening with my problem. The
situation is like this:

I have an ImageView configured in res/layout/image.xml. I have a
res/layout-port and a res/layout-land directory that holds a layout
with a Gallery for the former and a ListView for the latter. Both uses
the same ImageAdapter I wrote, and the getView() looks like this:
http://paste2.org/p/938866  (note a typo with 'cursor' and 'c', it
should be just 'c' or just 'cursor').

When the .xml file sets the background:
android:background="@drawable/gallery_unselected_default", ListView
puts on top of it the ImageView making it invisible. But, if we
uncomment the line 10 of the paste (and remove android:background from
the xml) ListView puts the background and then the Drawable inside the
background as _almost_ desired. The background is a 9-patch well
formed. I said _almost_ because it doesn't strecht it to the
background's content bound. I know it's not a Gallery and this widget
does that because it's supposed to do that. But first, I want to
realize why is happening what I mentioned before.

For debugging purpouses, I wrote in the getView() method a line like this:
if (position == 0) return inflater.inflate(R.layout.image, parent, false);

I realize then, that the background was placed behind the Drawable like this:
http://labombiya.com.ar/media/image1.jpg


So, I removed the android:background line, uncommented the line 10 of
the paste and the background was placed like this:
http://labombiya.com.ar/media/image2.jpg

Tha Gallery shows it fine in both situation. Setting the background
through the xml file or through the code. But, that's because it's a
Gallery, I'm aware of that and it's supposed to be so. But, what I
cannot understand is this two differents behaviour with ListView when
setting the background programmatically, or through xml.

I cannot know why, so I'll be grateful if someone realize why. I mean,
I can live with it but I need to know why is happening and why
ImageView isn't scaled. Here's image.xml:

http://paste2.org/p/938892

Cheers,
-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

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