如何将 simpleExpandableListAdapter 或类似的东西应用于 ListFragment 中的 ListView
我正在使用 ListFragment 并想要制作一个困难的列表,其中有子列表,并且不知道如何做到这一点(( 一些代码:
public class CarsOfBrandFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
String[] s = {"colorName"};
int[] k = {R.id.groupname};
String[] s1 = new String[]{"shadeName", "rgb"};
int[] k1 = new int[]{R.id.childname, R.id.rgb};
SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter(getActivity(), createGroupList(),
R.layout.grouprow, s, k, createChildList(), R.layout.childrow, s1, k1);
setListAdapter(expListAdapter);
}
android.support.v4.app.ListFragment 中的 setListAdapter(android.widget.ListAdapter) 无法应用于 (android.widget.SimpleExpandableListAdapter)
I am working with ListFragment and want to make a difficult list, which has sublists and don't know how I can do it((
Some code:
public class CarsOfBrandFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
String[] s = {"colorName"};
int[] k = {R.id.groupname};
String[] s1 = new String[]{"shadeName", "rgb"};
int[] k1 = new int[]{R.id.childname, R.id.rgb};
SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter(getActivity(), createGroupList(),
R.layout.grouprow, s, k, createChildList(), R.layout.childrow, s1, k1);
setListAdapter(expListAdapter);
}
setListAdapter(android.widget.ListAdapter) in android.support.v4.app.ListFragment cannot be applied to (android.widget.SimpleExpandableListAdapter)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能把它设置在ListView本身上吗?
Can't you just set it on the ListView itself?
好吧,我通过显式指示
ExapndableListView
来决定这一点 - 是的,我在 Expandable 上更改了通常的 ListView,并使用SimpleCursorTreeAdapter
而不是SimpleExpandableListAdapter
Ok I decided this by explicit indicating of
ExapndableListView
- yes I changed usual ListView on Expandable, and usingSimpleCursorTreeAdapter
instead ofSimpleExpandableListAdapter