layout_width="wrap_parent" in GridView does not work as I expect

by Mark Murphy » Fri, 26 Sep 2008 13:21:37 GMT

Sponsored Links

Possibly by default android:stretchMode behaves as "AUTO_FIT".

Try android:stretchMode="NO_STRETCH", or possibly android:stretchMode=" 
STRETCH_COLUMN_WIDTH" or "STRETCH_SPACING", in your layout XML for your 
GridView, to see if one of those settings is more to your liking.

Mark Murphy (a Commons Guy) 
Warescription: All titles, revisions, & ebook formats, just $35/year


layout_width="wrap_parent" in GridView does not work as I expect

by Kah0ona » Fri, 26 Sep 2008 13:28:19 GMT


Not entirely sure if such questions belong here, but anyways.

I have a simple main.xml file with a GridView inside a LinearLayout
(orientation=vertical). The GridView has numColumns specified at 3 and
there are exactly 9 objects in the grid, creating a 3x3 matrix, where
each columnWidth is fixed at 30dp. Both layout_height and _width are
specified as "wrap_content".

Under the gridview is a simple TextView with a hardcoded string in it.

Now on the bottom this wrap_content works; i can tell by putting a
different background color, to see the edges of the gridview. But on
the right side, it fills up to fill the screen, as if fill_parent was
specified! What am I doing wrong here? What is the reason that it
doesn't wrap the content horizontally, but it DOES vertically?


Sponsored Links

layout_width="wrap_parent" in GridView does not work as I expect

by Kah0ona » Fri, 26 Sep 2008 17:31:52 GMT

 hm that didn't work... I kind of refuse to use a hardcoded width,
which works, but is sub-optimal...


Other Threads

1. Fine-tuning the WebView

Hash: SHA1

I'm using WebView for rendering some moderately complex texts. It
works nicely for what I need. The only things that I still need to do
is some tuning in the way texts are rendered; in particular, the font
family and size and the padding (it seems that the component
automatically puts 6-8dips of padding even though I've specified 0; so
it doesn't get aligned with other components in the same view.

I suppose the best way is by means of a CSS, right? Is it possible to
put an external reference to an existing file, or does the CSS need to
be embedded in the document? I'd like to see some examples.


- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere." -
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla -



2. Post about SSLEngine

I had posted a topic about a problem I was having  using SSLEngine on
Android to this forum. But, unfortunately I can't even find that
message anywhere.

Is it still in the moderation queue or did you find something
offending there, and it didn't pass the moderation?

If this is not the right forum for such a question, please guide me to
the appropriate list.


3. How to include progress dialogue..?

4. AES Decrypt and Encrypt problem

5. How to get Latitude and longitude information

6. I am a newbie;need Yahoo Messenger for Android 1.6

7. Samsung Galaxy S front facing camera.