【发布时间】:2015-12-20 22:17:13
【问题描述】:
我正在制作这个应用程序,我的状态栏、操作栏和页面滑块都紧挨着。我想在它们之上放置一个共同的背景,并在用户滚动时将其淡化。
这很像“Now for Reddit”应用程序的外观。请指导我如何做到这一点。谢谢!
当前代码:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:id="@+id/toolbar"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
>
</android.support.v7.widget.Toolbar>
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#3F51B5"
android:textSize="14sp"
android:fontFamily="sans-serif-light"
/>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.politicsappv2.MainActivity" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
对于 PagerSlidingTabStrip,我使用的是this git repo
这是目前的样子:
但这是目标:
【问题讨论】:
标签: java android animation android-actionbar statusbar