6
İçinde iki resim bulunan, arka plan için bir tane ve bir üst logo olarak bulunan CollapsingToolbarLayout kullanıyorum. Fikir, onları hem paralaks yapmaktır. Bu şey, Android 5'te fiziksel cihazlarda iyi çalışır, ancak daha düşük sürümlere sahip cihazlarda (veya emülatörlerde) çalışır. Bir çeşit tuhaf.ImageView CollapsingToolbarLayout belirli cihazlarda görünmez
<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">
<NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff">
<!--content-->
</FrameLayout>
</NestedScrollView>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="#222">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll">
<ImageView
android:id="@+id/header_bk"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
/>
<ImageView
android:id="@+id/header_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_logo"
app:layout_collapseMode="parallax"
android:background="#44ff0000"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>