本文介绍了AppBarLayout - 布局有时看不见一旦进入视图(即使是没有进入它)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,即有时AppBarLayout不会显示其全部内容时,你玩它周围的所有时间:
I have a problem where sometimes the AppBarLayout will not show its full content all the time when you play around with it:
<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.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout
android:orientation="vertical"
android:layout_height="148dp"
android:layout_width="match_parent">
<android.support.design.widget.TabLayout
app:layout_scrollFlags="scroll|enterAlways"
android:layout_height="48dp"
android:background="@color/primarycolor"
.../>
<RelativeLayout
app:layout_scrollFlags="scroll|enterAlways"
android:background="@color/white"
android:layout_height="100dp"
...>
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
提供的解决方案是
A solution provided is
CoordinatorLayout工具栏上输入直到全高度隐形
但是:它提供了一个完整的行不是色作为主色我在底部布局指定一样的,因为它的背景是白色的。思考?
BUT: it provides a full line that is not the same color as the primary color I specify in the bottom layout, because its background is white. Thoughts?
推荐答案
这是延长上面提供的一个解决方案:
使用此,而不是提供的一个,这将融合了appbarlayout和它下面的微妙阴影高程。
This is a solution extending the one provided above:Use this instead of the one provided, which will blend the appbarlayout and the subtle shadow elevation below it.
<View
android:id="@+id/appbar_bottom"
android:layout_width="match_parent"
android:layout_height=".3dp"
android:background="#606060"
android:visibility="visible"/>
和生成的布局:
<android.support.design.widget.AppBarLayout
android:orientation="vertical"
android:layout_height="148.3dp"
android:layout_width="match_parent">
<android.support.design.widget.TabLayout
app:layout_scrollFlags="scroll|enterAlways"
android:layout_height="48dp"
android:background="@color/primarycolor"
.../>
<RelativeLayout
app:layout_scrollFlags="scroll|enterAlways"
android:background="@color/white"
android:layout_height="100dp"
...>
</RelativeLayout>
<View
android:id="@+id/appbar_bottom"
android:layout_width="match_parent"
android:layout_height=".3dp"
android:background="#606060"
android:visibility="visible"/>
</android.support.design.widget.AppBarLayout>
这篇关于AppBarLayout - 布局有时看不见一旦进入视图(即使是没有进入它)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!