我正在尝试在同一ScrollView
中使用NavDrawer
和Activity
。一切都很好,但我无法滚动。我可以按照我的要求并排NavDrawer
和ScrollView
,但我无法滚动。屏幕是固定的,虽然屏幕上有滚动条,但它没有向上或向下滚动。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginTop="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
</LinearLayout>
</ScrollView>
<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="start">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_homepage1"
app:menu="@menu/activity_homepage1_drawer" />
</android.support.v4.widget.DrawerLayout>
答案 0 :(得分:0)
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginTop="100dp"
android:layout_width="match_parent" android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="16dp"
android:background="#fff"
android:elevation="4dp"></FrameLayout>
</LinearLayout>
</ScrollView>
<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="start">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_homepage1"
app:menu="@menu/activity_homepage1_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>