【发布时间】:2017-07-16 23:09:41
【问题描述】:
直奔主题。我想为我的应用程序有一个底部导航栏,然后在顶部有一个工具栏,中间是一个滚动视图,内容将被放置在其中。
现在的问题是 ScrollView 布局将导航栏推到视野之外,现在导航栏不会显示。
我尝试了另一种解决方案,但结果是导航栏弹出在 ScrollView 的顶部
That blue bar below the Home toolbar is the navigation bar.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="polytechnic.temasek.bluebeatsmusicapplication.HomePageActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@drawable/bluebeatsbackground2">
<TextView
android:id="@+id/toolbartitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Home"
android:textColor="@android:color/white"
android:textSize="32sp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="match_parent"
android:layout_height="539dp"
>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="0dp">
[Content inside]
</android.support.constraint.ConstraintLayout>
</ScrollView>
<android.support.design.widget.BottomNavigationView
android:id="@+id/the_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:background="@color/colorPrimary"
app:itemBackground="@color/colorPrimary">
</android.support.design.widget.BottomNavigationView>
</LinearLayout>
到目前为止,我只能将 Scrollview 的高度强制到某个 dp 以为导航栏腾出空间,但我应该还有另一种方式吗?
【问题讨论】:
标签: java android android-layout