我需要创建一个顶部带有标题栏的布局和带有 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 中心按钮,两个按钮都会被单击。我没有找到解决这个问题的方法。
任何人都可以帮忙吗?
非常感谢!