I need to know how to set the LayoutParam
according to the resolution of the mobile phones..
Im using a GridView
where I'm using GridView.LayoutParams(45, 45)
.. Now if I'm using mobile with small screen size is ok.. But if I test with the big screen device like HTC Desire HD then its looking so small.. How to make everything as similar?
Asked
Active
Viewed 904 times
0
2 Answers
0
Divide your display's width in 3 parts (for 3 columns or 4 for 4 columns....)
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
imageView.setLayoutParams(new GridView.LayoutParams(width/3 , width/3));

Matteo Cardellini
- 876
- 2
- 17
- 41
0
Does using android:numColumns or setNumColumns(int numColumns) not work for your needs?
http://developer.android.com/reference/android/widget/GridView.html#setNumColumns(int)

Thane Anthem
- 4,093
- 4
- 26
- 24