亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

一個 XML 布局中的 Toolbar、BottomNavigationView

一個 XML 布局中的 Toolbar、BottomNavigationView

喵喵時光機 2022-04-28 16:03:49
我的 XML 布局需要幫助,因為我需要將 Toolbar、FrameLayout、BottomNavigationView 放在一個活動中,下面是我的代碼,工具欄沒有出現的問題只有 FrameLayout 和 BottomNavigationView<android.support.constraint.ConstraintLayout    android:layout_width="match_parent"    android:layout_height="match_parent"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:fitsSystemWindows="true"    xmlns:android="http://schemas.android.com/apk/res/android">    <include        android:id="@+id/app_bar"        android:layout_height="wrap_content"        android:layout_width="wrap_content"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintRight_toRightOf="parent"        app:layout_constraintTop_toTopOf="parent"        layout="@layout/app_bar_layout" />    <FrameLayout        android:id="@+id/activity_content"        android:layout_width="match_parent"        android:layout_height="match_parent"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintRight_toRightOf="parent"        app:layout_constraintTop_toTopOf="@+id/bottom_navigation"        app:layout_constraintTop_toBottomOf="@+id/app_bar"        />    <View        android:id="@+id/horizontalDivider"        android:layout_width="match_parent"        android:layout_height="0.3dp"        android:layout_above="@+id/bottom_navigation"        android:layout_gravity="center_vertical"        android:background="@android:color/black" />    <include        android:id="@+id/bottom_navigation"        layout="@layout/bottom_navigation"        android:layout_alignParentBottom="true"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintRight_toRightOf="parent"        android:layout_height="wrap_content"        android:layout_width="match_parent"        /></android.support.constraint.ConstraintLayout>
查看完整描述

1 回答

?
Helenr

TA貢獻1780條經驗 獲得超4個贊

試試這個


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"

    android:layout_height="match_parent">


    <include

        android:id="@+id/app_bar"

        layout="@layout/aa"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        app:layout_constraintLeft_toLeftOf="parent"

        app:layout_constraintRight_toRightOf="parent"

        app:layout_constraintTop_toTopOf="parent" />


    <FrameLayout

        android:id="@+id/activity_content"

        android:layout_width="match_parent"

        android:layout_height="0dp"

        android:background="@color/colorAccent"

        app:layout_constraintBottom_toTopOf="@+id/horizontalDivider"

        app:layout_constraintHorizontal_bias="0.5"

        app:layout_constraintLeft_toLeftOf="parent"

        app:layout_constraintRight_toRightOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/app_bar" />



    <View

        android:id="@+id/horizontalDivider"

        android:layout_width="match_parent"

        android:layout_height="5dp"

        android:layout_gravity="center_vertical"

        android:background="@android:color/black"

        app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"

        app:layout_constraintLeft_toLeftOf="parent"

        app:layout_constraintRight_toRightOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/activity_content" />



    <include

        android:id="@+id/bottom_navigation"

        layout="@layout/aa"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        app:layout_constraintBottom_toBottomOf="parent"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/horizontalDivider" />


</android.support.constraint.ConstraintLayout>

輸出

http://img1.sycdn.imooc.com//626a4a86000194bd02490393.jpg

查看完整回答
反對 回復 2022-04-28
  • 1 回答
  • 0 關注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號