gpt4 book ai didi

android工具栏显示一半内容

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:27:22 25 4
gpt4 key购买 nike

enter image description here

我使用 CoordinatorLayout 和 CollapsingToolbarLayout,我不知道是什么原因导致这个错误,这是我的 xml 文件

Activity 的main.xml

<?xml version="1.0" encoding="utf-8"?>

     Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true">

<include layout="@layout/toolbar" />


<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />


</android.support.design.widget.CoordinatorLayout>

工具栏 View 的toolbar.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/actionbar"
app:expandedTitleTextAppearance="@style/actinbar.textview.big"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:statusBarScrim="@color/actionbar"
app:titleEnabled="false">



<ImageView
android:id="@+id/toolbarbg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/bg_ovenui_pic_"
android:visibility="gone"
app:layout_collapseMode="parallax" />

<RelativeLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_gravity="bottom"
android:visibility="gone"></RelativeLayout>

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/ToolBarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways" />

</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

最佳答案

从 AppBarLayout 中删除 android:fitsSystemWindows="true"就可以了。启用后,AppBarLayout 假定状态栏不可用并且它必须占据整个空间。

关于android工具栏显示一半内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35571729/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com