Dory
Dory

Reputation: 7582

Android Grid View image size according to screen density

The grid view of my application has 4 rows and 4 columns. I want this to fill half screen ,irrespective of the screen size of the device. How can i set the image view size accordingly

Upvotes: 0

Views: 1157

Answers (2)

Ravi
Ravi

Reputation: 717

Define size of image view in dp,which will set the size according to screen density.

Upvotes: 2

Avram Score
Avram Score

Reputation: 4095

The easiest way would be to set the size of the GridView in dip (device-independent pixels). You can do this via your XML layout file, explicitly or with the help of the visual editor. As device-independent pixels are essentially percentiles, the Android platform will handle resizing for you based on the size and density of the device displaying. In order words, a value of android:layout_width="50dip" will look the same on any device.

Upvotes: 0

Related Questions