我正在实现一个侧面菜单,其中包含Listview和Expandable listview以及底部的按钮。如果listview或expandable listview很大,则按钮a底部不可见。 Listview和Expandable listview分别滚动。我想在整体上滚动所有内容。
我可以在哪里放置scrollview。在Drawyerlayout或导航视图中?
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="right">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@color/sidemenu_background"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/student_name_layout"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="@+id/stuent_name"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Student Name"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="16sp"
tools:layout_editor_absoluteY="75dp"
tools:layout_editor_absoluteX="8dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/sidemenu_divider"
tools:layout_editor_absoluteY="75dp"
tools:layout_editor_absoluteX="64dp" />
</LinearLayout>
<ListView
android:id="@+id/list_menu_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/sidemenu_divider"
android:dividerHeight="1dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/sidemenu_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/dynamic_expandable_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:childDivider="@color/sidemenu_divider"
android:groupIndicator="@null" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/sidemenu_divider" />
<android.support.constraint.ConstraintLayout
android:id="@+id/logout_view"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<TextView
android:id="@+id/logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="8dp"
android:text="@string/sign_out_text"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.49"
android:layout_marginStart="15dp" />
<ImageView
android:id="@+id/image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logout_icon"
android:layout_marginStart="16dp" />
</android.support.constraint.ConstraintLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/sidemenu_divider" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>