Consider a listview contain 2 images and am using an adapter to make a sequence of them. I wish to set the height of an image as 1/3 of the screen size. Is that possible? If
Yes. If you are using an adapter to set the items in the ListView, then you can set the size of each view in it as it is created. In getView()
in the adapter you can add after you have set up the view:
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Which will give you the actual screen dimensions, then
view.setHeight(height/3);
return view;
To return that view.
Yes, it is possible to set the height. To know how, check the answers to this question: How to Get Device Height and Width at Runtime?