gpt4 book ai didi

android - 在 Android 布局底部添加工具栏时滚动行为不起作用

转载 作者:行者123 更新时间:2023-11-30 01:36:22 25 4
gpt4 key购买 nike

我必须根据设计在屏幕底部添加一个工具栏。如果我删除协调器内的相对布局,app:layout_scrollFlags="scroll|enterAlways" 工作正常。

但如果没有这个相对布局,我无法将工具栏设置在屏幕底部!

如何通过更改以下布局来设法获得底部工具栏和顶部工具栏隐藏功能?

<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">

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

<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:background="@color/tab_color" />


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

<include
layout="@layout/inc_bottom_toolbar_with_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />

<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomToolBar"
android:layout_below="@id/appBarLayout"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />


</RelativeLayout>

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

PS:我已经删除了图片,因为我的 TL 坚持这样做..

最佳答案

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

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

<!-- bottom contents here --->

</RelativeLayout>

关于android - 在 Android 布局底部添加工具栏时滚动行为不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35055868/

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