Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 分段列表视图和可展开列表视图_Android_Listview_Expandablelistview - Fatal编程技术网

Android 分段列表视图和可展开列表视图

Android 分段列表视图和可展开列表视图,android,listview,expandablelistview,Android,Listview,Expandablelistview,我需要创建一个顶部有一个标题栏的布局和一个包含n个部分的列表视图。这个 每个部分的列表标题都有两个不同的按钮,它们必须可以独立单击和聚焦。这是布局的代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientat

我需要创建一个顶部有一个标题栏的布局和一个包含n个部分的列表视图。这个 每个部分的列表标题都有两个不同的按钮,它们必须可以独立单击和聚焦。这是布局的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:orientation="vertical">

    <include layout="@layout/title_bar" />

    <ListView android:id="@android:id/list" 
      android:layout_width="fill_parent"
      android:layout_height="0dip" 
      android:layout_weight="1.0"   
    />
</LinearLayout>

我尝试了这两种解决方案,但发现了两种方法都无法解决的问题:

1) 使用分段适配器(可以找到源代码)。如果没有标题栏,它可以正常工作,但是有了标题栏,默认的聚焦算法就不再工作了。
2) 使用ExpandableListAdapter(在这种情况下,布局中的ListView显然会变成ExpandableListView)。它工作正常,但如果我按下组布局上的dpad中心按钮,两个按钮都会被单击。我没有找到解决这个问题的办法

有人能帮忙吗


非常感谢

试试合并适配器怎么样?它允许您添加多个列表和按钮

“每个部分的列表标题都有两个不同的按钮,它们必须相互独立地单击和聚焦。”--为什么?这是我正在开发的应用程序所需要的功能。单击第一个按钮可启动一项活动,单击第二个按钮可启动另一项活动。无论如何,使用实现时最麻烦的问题是在ListView之外添加另一个布局时的焦点。