Android ListFragment

来源:互联网 发布:2001年全明星赛数据 编辑:程序博客网 时间:2024/05/18 01:27

Android ListFragment

1.ListFragment布局定义如下

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"         android:orientation="vertical"         android:layout_width="match_parent"         android:layout_height="match_parent">     <ListView android:id="@id/android:list"               android:layout_width="match_parent"               android:layout_height="match_parent"               android:background="#00FF00"               android:layout_weight="1"               android:drawSelectorOnTop="false"/> </LinearLayout>

设置适配器器需要使用ListFragment.setListAdapter(),不能使用listView去设置。另外需要在onCreateView之后设置适配器。
2.ListFragment的item项点击事件触发重写:OnListItemClick。
0 0
原创粉丝点击