1
我想要獲得漸變,這是我的選項卡式工具欄的背景,以便在半透明狀態欄上延伸,如下圖所示。android將工具欄擴展爲半透明狀態欄,同時在systemview中保留其他佈局對象
我已經嘗試使用LAYOUT_NO_LIMITS和TRANSLUCENT_NAVIGATION標誌來實現這一點,但然後在工具欄的一半的狀態欄下,去和導航欄下的小吃店去。
這是當前佈局文件:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="software.endeavor.projectg.TabbedActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="@drawable/main_gradient">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/main_gradient"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@android:color/white"/>
</android.support.design.widget.AppBarLayout>
<View
android:id="@+id/toolbar_shadow"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_below="@id/toolbar"
android:background="@drawable/toolbar_dropshadow" />
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="368dp"
android:layout_height="495dp">
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
我怎麼會去的標籤工具欄梯度延伸到狀態欄,同時仍保持良好的系統佈局邊界和保持常規的彩色導航欄?