In a Listview I want create a square button that is as wide as the list item is heigh.I don't want to set fixed width and height as it should work for different resolutions. Is is possible?
A:
In your layout xml file tell it to fill it's parent:
<Button android:layout_width="fill_parent" .... ></Button>
Or if you are using the API I think you should be able to use setLayoutParams:
myButton.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
Maxwell Troy Milton King
2010-02-12 12:14:25
the row consists of a TextView and a Button, the button should be has wide as the row is high. If a smaller font is used the button should adjust.
friedger
2010-02-14 11:51:27
A:
Use density independent pixel (dip) which is a virtual pixel unit to express layout dimensions or position in a density-independent way.
dtmilano
2010-02-12 18:08:39