Pregunta

I have a GridView containing ImageView all of the same size. Each ImageView has its width set to wrap_content, so that I can support multiple screen resolutions by picking the correct version of my Drawable resource.

I can't find a way to automatically set the column size of my GridView to the ImageView's width.

This can probably be done programmatically using

mGridView.setColumnsWidth(mImageView.getWidth());

but I can't find a way to do it using only XML. Does such way exists?

¿Fue útil?

Solución

Try this:

android:stretchMode="columnWidth"

Otros consejos

Try this-

android:columnWidth="50dp"

Here you can give the dimension.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top