標籤:android style http 使用 io ar line res
如何設定list view中的item的高度呢?
樣本如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" > //直接在這裡設定高度是不會生效的。
<!—- 具體的item 內容 —>
</RelativeLayout>
按照如下修改:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" // 再增加一層即可設定高度
android:layout_gravity="center_horizontal" >
<!—-具體的 item內容 —>
</RelativeLayout>
</RelativeLayout>
另外,如何避免 list view adapter反覆getivew?
list view在layout種設定時width/height 為match_parent. 或者為指定的大小。 如果使用wrap_content的話,就很又可能導致反覆get view.