android listの設定についてitem高さ問題

1157 ワード

アプリケーションでリストにデータを表示する必要がある場合、listviewというコントロールが一般的に使用されます.listviewの各項目はlist_です.item.
この場合、list_を設定する必要があるかもしれません.itemの高さ.
通常、ルートノードの高さは次のように設定されます.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="145dp"
    >

何が原因なのか、効果がないのか、背景画像を使うことを考えたら、次のように追加してもいいです.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <RelativeLayout 
        android:layout_width="fill_parent"
    	android:layout_height="145dp"
        android:id="@+id/around_main_list_item_bg"
        >

背景画像を使用する必要がない場合は、ルートノードの上にminHeightプロパティを追加できます.
具体的にはこの文章を読むことができるhttp://blog.csdn.net/l_serein/article/details/7403992
リスト_itemの中の内容はとても簡単で、例えば1つのTextViewだけあって、padding属性を使うことを考慮することができて、内向的に大きく支えます