【问题标题】:Custom Expandable Listview add button自定义可扩展列表视图添加按钮
【发布时间】:2014-11-10 09:55:37
【问题描述】:

1 如图部分所示,我做了那部分。但是,我需要在这个地方之前添加一个子实体,我找不到如何做第 2 部分。

XML 代码

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


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


    <ExpandableListView
        android:id="@+id/drawer_list"
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:layout_gravity="start"
        android:background="#858585"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent" />


    <ListView
         android:id="@+id/right_drawer"
         android:layout_width="240dp"
         android:layout_height="match_parent"
         android:layout_gravity="end"
         android:choiceMode="singleChoice"
         android:divider="@android:color/transparent"
         android:dividerHeight="0dp"
         android:background="#858585"/>

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

【问题讨论】:

  • &lt;ListView android:id="@+id/right_drawer"在哪里??
  • 你能在图片中点List和Expandable List吗?
  • &lt;ListView android:id="@+id/right_drawer" 不重要。具有重要左派@Stella
  • 可扩展列表点1.这张图片不包括listview那部分无论如何都无所谓@SweetWisherツ
  • 你试过我的代码了吗??有什么帮助吗?

标签: android android-listview expandablelistview


【解决方案1】:

您可以在 相对布局 中添加带有属性android:layout_alignParentBottom="true" 的布局以使其底部对齐:

 <RelativeLayout 
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start" >

   <!-- whatever the control you want here -->
   <ExpandableListView
    android:id="@+id/drawer_list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#858585"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent" />

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:text="Button1" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:text="Button2" />
    </LinearLayout>

</RelativeLayout>

【讨论】:

  • 不是列表视图,ExpandableListView。
  • 然后改成ExpandableListView
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-10
  • 1970-01-01
相关资源
最近更新 更多