【发布时间】:2017-12-10 17:03:11
【问题描述】:
我有一个协调器布局,上面有一个播放器信息栏,底部有一个导航栏,它们固定在那里。在中间我有一个包含滚动视图的相对布局,问题是滚动视图不滚动。此外,出于测试目的,我在滚动视图内部的相对布局周围放置了一个边框,正如您所看到的,布局的大小比它应该的要小。
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.felix043.thedungeon.Main.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Player Infos -->
<include layout="@layout/layout_playerinfo"></include>
<!-- ViewPager -->
<RelativeLayout
android:id="@+id/QuestRelLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
layout="@layout/layout_viewpager">
</include>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/playerinfo"
android:layout_above="@+id/bottomNavLayout">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/playerinfo"
android:layout_above="@+id/bottomNavLayout">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomNavLayout"
android:layout_below="@+id/playerinfo"
android:background="@drawable/text_border">
<Button
android:id="@+id/button8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button7"
android:layout_marginBottom="28dp"
android:layout_marginStart="72dp"
android:layout_toEndOf="@+id/button7"
android:text="Button" />
<Button
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="50dp"
android:layout_marginStart="41dp"
android:text="Button" />
<Button
android:id="@+id/button9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button8"
android:layout_marginBottom="29dp"
android:layout_marginEnd="12dp"
android:layout_toStartOf="@+id/button8"
android:text="Button" />
<Button
android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button9"
android:layout_alignStart="@+id/button8"
android:layout_marginBottom="46dp"
android:layout_marginStart="24dp"
android:text="Button" />
<Button
android:id="@+id/button11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button10"
android:layout_toStartOf="@+id/button8"
android:text="Button" />
<Button
android:id="@+id/button12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:text="Button" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<!-- BottomNav -->
<include layout="@layout/layout_navbar"></include>
</RelativeLayout>
预期结果:滚动视图与屏幕一样大,没有播放器信息和导航栏,它应该是可滚动的。
【问题讨论】:
标签: android android-scrollview android-coordinatorlayout android-relativelayout