【问题标题】:Android RelativeLayout Z Order LayeringAndroid RelativeLayout Z 顺序分层
【发布时间】:2017-01-24 07:53:41
【问题描述】:

我的 activity_main.xml 存在问题,如下图所示的底部栏似乎切断了我的主要片段容器的底部,并在其顶部分层而不是出现在其下方。

底部栏应出现在主容器下方,而不是在其上方分层。

有人可以帮我吗,因为我已经尝试了所有方法。

<?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_new"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        android:id="@+id/my_toolbar"
        layout="@layout/toolbar">
    </include>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/fragmentContainerNew"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_above="@+id/bottomBar" />

        <com.roughike.bottombar.BottomBar
            android:id="@+id/bottomBarNew"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_alignParentBottom="true"
            app:bb_tabXmlResource="@xml/bottombar_tabs" />

    </RelativeLayout>

</LinearLayout>

<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:menu="@menu/activity_main_drawer" />

bottom part of activity_main

【问题讨论】:

  • 使用父布局下方的Relativelayout
  • 你好 W4R10CK,你能举个例子来说明变化吗?
  • 检查我的答案
  • 我刚刚回答,检查并尝试运行。

标签: android android-relativelayout z-order


【解决方案1】:

您忘记添加正确的 id @+id/bottomBarNew,更改您的值:

    <FrameLayout
        android:id="@+id/fragmentContainerNew"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_above="@+id/bottomBarNew" />  //<---here

【讨论】:

    猜你喜欢
    • 2011-02-06
    • 2016-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    • 2017-02-03
    相关资源
    最近更新 更多