【问题标题】:Android bottom toolbar disappears when fragment fills screen片段填满屏幕时Android底部工具栏消失
【发布时间】:2016-12-01 09:28:56
【问题描述】:

我正在开发一个 android 应用程序,并且正在使用屏幕顶部的工具栏和屏幕底部的导航栏。我正在使用单个活动来创建顶部和底部工具栏和片段以更改工具栏之间的内容。但是,当片段中的内容超出屏幕大小时,底部栏会消失。

这是我的家庭活动 xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_home"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.rentables.testcenter.HomeActivity">


    <include
        android:id="@+id/toolbar_main"
        layout="@layout/toolbar_main"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />



    <fragment android:name="com.rentables.testcenter.HomeFragment"
        android:id="@+id/fragment_place"
        android:layout_weight="0"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:layout="@layout/fragment_home" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="bottom">
        <include
            android:id="@+id/toolbar_navigate"
            layout="@layout/toolbar_navigate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center|bottom"/>
    </LinearLayout>
</LinearLayout>

我猜这是因为我有内部线性布局,但我不确定如何让导航栏在底部保持静态。任何帮助都是极好的。谢谢

【问题讨论】:

    标签: android android-layout android-fragments


    【解决方案1】:

    想通了。我只是将整个东西更改为相对布局,摆脱了内部线性布局,而不是重力,我使用了 alignParentBottom="true"。

    【讨论】:

      猜你喜欢
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-16
      • 2016-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多