Gần đây tôi đã gặp sự cố với bố cục điều phối viên. Khi tôi cố gắng tạo bố cục thanh công cụ thu gọn đơn giản như trong ví dụ this, thanh công cụ sẽ ở dưới thanh trạng thái như trong ảnh chụp màn hình bên dưới (trên thiết bị preLolipop mọi thứ hoạt động tốt, vì ứng dụng không vẽ dưới thanh trạng thái).Thanh công cụ thu gọn - thanh công cụ trong thanh trạng thái
đoạn mã của bố trí Hoạt động của tôi:
<?xml version="1.0" encoding="utf-8"?>
<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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/imageCalculationDetail"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/ic_dummy_calculation"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/transparent"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/container"/>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
My Styles (chỉ v21), nơi BaseAppTheme mẹ là Theme.AppCompat.Light.NoActionBar:
<style name="AppTheme" parent="BaseAppTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorAccent">@color/colorPrimary</item>
<item name="android:colorButtonNormal">@color/button_state_list</item>
<item name="android:statusBarColor">@color/transparent</item>
</style>
Đăng tệp styles.xml của bạn. –
Tôi đã thêm kiểu vào câu hỏi –
Còn tệp kê khai của bạn thì sao? Bạn đã chỉ định đúng kiểu ở đó chưa? Đăng bài đó quá. Bởi vì tôi đã thử bố cục tương tự và mọi thứ đều tốt đẹp trên trình giả lập lollipop. –