조각에서 사용하는 시차 효과가 적용된 레이아웃을 만들었습니다.툴바 및 DrawerLayout 축소
<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.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/collapsingImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/baner_1"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!--OTHER SCROLABLE STUFF-->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Activity의 루트 (container_main)에 Fragment가 부풀어 오르는 한 제대로 작동합니다.
그래서 활동의 레이아웃은 다음과 같습니다
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</FrameLayout>
지금 여기 내 활동에 DrawerLayout를 추가 할 내가 갇혀있는 곳입니다.
DrawerLayout을 추가하여 Activity의 레이아웃을 변경했습니다.
그런 다음 위의 조각을 동일한
container_main
에 부 풀되 시차도
NestedScrollView
도 작동하지 않습니다.
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/container_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
</FrameLayout>
<ListView
android:id="@+id/drawerListView"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
/>
</android.support.v4.widget.DrawerLayout>
축소 도구 모음을 사용하여 DrawerLayout을 사용하려면 어떻게해야하나요?
네비게이션을 추가 하시겠습니까? –
예, 내비게이션이 필요합니다 –
은 listview에 중력을 제공하는 것을 잊어 버렸을 수 있습니다. android : layout_gravity = "start" – Riten