내비게이션 막대를 완전히 투명하게 만들고 상태 표시 줄을 투명하거나 반투명하게하고 싶습니다! fitsSystemWindows에 대한 올바른보기
그래서는 루트 레이아웃 탐색 모음이 성공적으로 투명하게 보여줍니다android:fitsSystemWindows="true"
에서 onCreate
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
이 내부 v21/styles
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">false</item>
이 내부에이 라인을 추가 상태 표시 줄이 겹쳐서 ..! xml의 모든 레이아웃에서 마지막 행을 이동하려했지만 운이 없었습니다. 가끔씩 겹쳐지는 것을 멈추었지만 nav 막대가 더 이상 투명하지 않습니다 ..! 어떤 도움이 필요합니까?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:autofit="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2d2b30">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorToolbar"
app:titleTextColor="@color/white"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/decoratoin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.017"
android:elevation="5dp"
android:scaleType="center"
android:src="@drawable/decoration0"/>
<!-- The Linearlayout with id="rootView" is the one that contains the major views -->
<LinearLayout
android:id="@+id/rootView"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="5dp"
app:cardBackgroundColor="#da2e2c30"
app:cardCornerRadius="2dp"
app:cardElevation="5dp">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<me.grantland.widget.AutofitTextView
android:id="@+id/txt"
android:layout_width="match_parent"
android:layout_height="95dp"
android:layout_margin="2dp"
android:padding="5dp"
android:maxLines="4"
android:text="ooooooooooo"
android:textColor="#ffff"
android:textSize="20sp"
autofit:minTextSize="12sp"/>
<ImageView
android:id="@+id/swipe_arrow"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical|end"
android:alpha="0.1"
android:src="@drawable/swipe_icon"/>
</FrameLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:clickable="true"
android:hapticFeedbackEnabled="true"
android:src="@mipmap/reset"/>
<TextView
android:id="@+id/btn_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:background="@mipmap/nums_max"
android:clickable="true"
android:elevation="10dp"
android:hapticFeedbackEnabled="true"/>
<TextView
android:id="@+id/btn_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="1dp"
android:background="@mipmap/azkar_list"
android:clickable="true"
android:elevation="10dp"
android:hapticFeedbackEnabled="true"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="@+id/arc_progress"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_marginTop="30dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="50dp"
android:layout_gravity="center_horizontal"
android:background="#2d2b30"
custom:arc_bottom_text=" "
custom:arc_bottom_text_size="35dp"
custom:arc_finished_color="@color/colorAccent"
custom:arc_progress="55"
custom:arc_stroke_width="20dp"
custom:arc_suffix_text=" "
custom:arc_text_color="#84e43b"
custom:arc_text_size="45dp"
custom:arc_unfinished_color="#2cf2f2f1"/>
<TextView
android:id="@+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:background="@drawable/check"
android:visibility="gone"/>
</FrameLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
페이지의 [이] (https://stackoverflow.com/a/43848091/1083957) 답변을 찾을 수 있습니다. – azizbekian
@azizbekian 글쎄, 내 xml에서'android : fitsSystemWindows = "true"'를 제거한 다음, 대답에서 설명한대로 내 도구 모음 대신'OnApplyWindowInsetsListener' 메소드를 추가 한 후에 작동했습니다 : D !! 나는이 방법이 왜 작동하는지에 대한 대답을 읽었지 만 ** 당신이 의미하는 바를 정확히 이해할 수 없었다. (... 루트 레이아웃은 WindowInsets를 소비 할 것이다.) ** 할 수 있다면 더 설명 할 수있다! –
[매체를 통한이 게시물] (https://medium.com/@azizbekian/windowinsets-24e241d4afb9)을 읽었는데, 어떻게 작동하는지 잘 설명하려고 노력했습니다. – azizbekian