【发布时间】:2013-09-10 21:50:13
【问题描述】:
我使用一个片段活动来保存一个呈现一堆产品的列表片段:
public class ProductsListActivity extends SherlockFragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Sherlock___Theme);
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_products_list);
// setFastScrollEnabled(true) ?
}
}
...
<!-- fragment_products_list.xml -->
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.example.fragment.ProductsListFragment"
android:id="@+id/list_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
...
public class ProductsListFragment extends SherlockListFragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// setFastScrollEnabled(true) ?
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
...
}
}
我想enable fast scrolling 获取产品列表,发现另一篇描述how to do this for a list activity 的帖子。但是如何激活片段的快速滚动?可以define this in XML 或通过代码。
【问题讨论】:
-
为什么不在 SherlockListFragment 中使用 getListView().setFastScrollEnabled(true)?
标签: android android-listview android-fragments android-listfragment fastscroll