【问题标题】:Expandable Listview inside Navigation Drawer not reach bottom of system bar导航抽屉内的可扩展列表视图未到达系统栏底部
【发布时间】:2014-01-20 19:51:53
【问题描述】:

我正在尝试在导航抽屉中实现“可扩展列表视图”,如下图所示。有4组,每组有很多孩子。我的问题是,可扩展列表视图的高度是“short”。如何使这个高度达到系统栏的底部,就像使用带有 4 组数据的列表视图的普通导航抽屉一样?

这是我的 main_activity.xml :

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>

<ExpandableListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/black"
    android:dividerHeight="1dp" 
    android:indicatorRight="430dp"/>

</android.support.v4.widget.DrawerLayout>

任何帮助将不胜感激。 环境:Windows 7、ADT、Genymotion。

【问题讨论】:

  • android:layout_width="240dp" 由 android:layout_width="match_parent" 修改
  • @Sandeep Tiwari 我已经将宽度更改为 match_parent 但仍然无法正常工作
  • 我正在尝试创建一个类似的导航抽屉,但我不知道如何使某些项目可扩展而其他项目不能。请附上已展开项目的图片,以便格式可见。

标签: android expandablelistview navigation-drawer


【解决方案1】:

也将背景颜色设置为ExpandableListView

<ExpandableListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/black"
android:dividerHeight="1dp" 
android:indicatorRight="430dp"
android:background="#fff"/>

我认为您的可扩展列表是 match_parent,但它没有背景,只有 4 个项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-28
    • 1970-01-01
    相关资源
    最近更新 更多