android - how to set ListView item height -
i have listactivity want change item height refer device height
public class mainactivity extends listactivity { . . . setlistadapter(new arrayadapter<string>(mainactivity.this, android.r.layout.simple_list_item_1,mainmenuitems)); } its listactivity on galaxy nexus s :

and on galaxy nexus 7 : 
how should define listview items height ???
the listview items height height of item layout contents, eg android.r.layout.simple_list_item_1 height. if want different height, create xml file , put layout_height or minheight attribute.
this modified simple_list_item_1 refers value
<textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelistitemsmall" android:gravity="center_vertical" android:paddingstart="?android:attr/listpreferreditempaddingstart" android:paddingend="?android:attr/listpreferreditempaddingend" android:paddingleft="?android:attr/listpreferreditempaddingleft" android:paddingright="?android:attr/listpreferreditempaddingright" android:minheight="@dimen/your_defined_minumum_height"/> and in dimen.xml
<dimen name="your_defined_minumum_height">48dp</dimen>
Comments
Post a Comment