5

Tôi không biết tại sao, nhưng có vẻ như khi thanh công cụ sụp đổ, xuất hiện thanh trạng thái thứ hai.Sự cố thu gọn thanh trạng thái thanh công cụ bố trí

Tôi đã sử dụng android:fitsSystemWindows="true" trong tất cả các thành phần, vì không có thanh công cụ này xuất hiện từ thanh trạng thái.

Dưới đây là một số hình ảnh để giải thích tốt hơn: Images

Tôi chưa bao giờ thấy một điều như vậy, và tôi đã cố gắng tất cả nhưng tôi không biết làm thế nào để giải quyết nó. Tôi không thể tìm thấy bất kỳ thứ gì trên mạng.


Đây mã:

Layout:

<android.support.design.widget.CollapsingToolbarLayout 
    android:id="@+id/collapsing_toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    app:statusBarScrim="?attr/colorPrimaryDark" 
    app:contentScrim="?attr/colorPrimary" 
    app:layout_scrollFlags="scroll|exitUntilCollapsed" > 

    <ImageView 
     android:id="@+id/photo_actor" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:scaleType="centerCrop" 
     android:fitsSystemWindows="true" 
     app:layout_collapseMode="parallax" /> 
    <View 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_collapseMode="parallax" 
     android:fitsSystemWindows="true" 
     android:background="@drawable/background_protection" /> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:fitsSystemWindows="true" 
     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"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:padding="8dp" 
     android:orientation="vertical"> 
     <WebView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@null" 
      android:id="@+id/webview_bio"/> 
    </LinearLayout> 
    </android.support.v4.widget.NestedScrollView> 

Hoạt động onCreate:

Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 
    if(collapsingToolbarLayout!=null){ 
     collapsingToolbarLayout.setTitle(advm.getName()); 
    } 

Styles : (cái tôi sử dụng trong Hoạt động hiện tại là thứ hai)

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:textColor">@color/text_color</item> 
</style> 

<style name="AppTheme.NoActionBar"> 
    <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
    <item name="android:windowTranslucentNavigation">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 

Trả lời

1

Có vẻ như một phần bổ sung thêm bởi CollapsingToolbarLayout trên fitSystemWindows(). Tôi nghĩ bạn cũng phải bật <item name="android:windowTranslucentStatus">true</item> ở cấp chủ đề (API19 +) để có bố cục ổn định vì ở chế độ toàn màn hình.

0

Ai phải đối mặt với vấn đề này, thêm video này vào yếu tố cha mẹ:

android:fitsSystemWindows="true" 

Trong đoạn mã trên tôi nghĩ rằng nó sẽ là:

<android.support.design.widget.AppBarLayout 
android:fitsSystemWindows="true" 
... 
> 
... 
</android.support.design.widget.AppBarLayout> 

Chúc may mắn, '.

Các vấn đề liên quan