日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android 内容显示栏,android – 在工具栏下显示内容

發布時間:2025/3/8 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android 内容显示栏,android – 在工具栏下显示内容 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

您好我試圖簡單地將我的內容放在工具欄下面,但是當我運行我的應用程序時,當它應該低于它時,一些內容隱藏在它后面.

我已經閱讀了關于使用框架布局來嘗試將其分開但我已經陷入困境.我目前正在使用隨軟件提供的基本android studio導航抽屜模板,并想知道我必須做出哪些更改.

我的協調員布局

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:theme="@style/AppTheme.AppBarOverlay">

android:id="@+id/toolbar"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

android:background="?attr/colorPrimary"

app:popupTheme="@style/AppTheme.PopupOverlay" />

android:id="@+id/fragment_container"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

我的抽屜布局

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

xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/drawer_layout"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:fitsSystemWindows="true"

tools:openDrawer="start">

layout="@layout/app_bar_main"

android:layout_width="match_parent"

android:layout_height="match_parent" />

android:id="@+id/nav_view"

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_gravity="start"

android:fitsSystemWindows="true"

app:headerLayout="@layout/nav_header_main"

app:menu="@menu/activity_main_drawer" />

我需要做出哪些改變?

解決方法:

許多ViewGroups允許他們的孩子重疊.這些包括FrameLayout,RelativeLayout,CoordinatorLayout和DrawerLayout.一個不允許其子項重疊的是LinearLayout.

你的問題的答案實際上取決于最終結果應該是什么.如果你想要一個總是在屏幕上的工具欄和它下面的一些內容,那么你根本不需要CoordinatorLayout和AppBarLayout,你可以使用一個帶有兩個子節點的垂直LinearLayout:

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

... />

android:id="@+id/fragment_container"

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_weight="1"

... />

注意FrameLayout的布局屬性.

如果你想在滾動內容的同時進行工具欄滾動和離開屏幕的花哨的東西,那么你需要一個AppBarLayout,你需要給你的內容區域一個特殊屬性,如下所示:

android:layout_width="match_parent"

android:layout_height="wrap_content"

... >

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

app:layout_scrollFlags="scroll"

... />

android:id="@+id/fragment_container"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

... />

標簽:android,android-toolbar,xml,android-layout,toolbar

來源: https://codeday.me/bug/20190930/1836908.html

總結

以上是生活随笔為你收集整理的android 内容显示栏,android – 在工具栏下显示内容的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。