سؤال

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?

هل كانت مفيدة؟

المحلول

Try this:

android:stretchMode="columnWidth"

نصائح أخرى

Try this-

android:columnWidth="50dp"

Here you can give the dimension.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top