2

Android 6.0. I want to has translucent status bar.

my_layout.xml:

<ScrollView
    android:id="@+id/srollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:fitsSystemWindows="true">
<LinearLayout
    android:id="@+id/content_layer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
<RelativeLayout
    android:id="@+id/containerPhoneNumber"
    android:layout_width="match_parent"
    android:layout_height="64dp">
<EditText
    style="@style/edit_text_style"
    android:layout_width="match_parent"
   android:layout_height="64dp"
/>
...
</ScrollView>  

styles.xml

<style name="RegistrationTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowTranslucentStatus">true</item>
</style>

As result the status bar is translucent. OK. When start my_layout.xml on Android 7.0 , and focus on editText the scroll success scrolling. OK. But when I run same my_layout.xml on Android 5.0/6.0 the scrolling is NOT work. Why? Thanks.

Alexei
  • 14,350
  • 37
  • 121
  • 240
  • Check if [this](http://stackoverflow.com/questions/7417123/android-how-to-adjust-layout-in-full-screen-mode-when-softkeyboard-is-visible/19494006) is not your case. – R. Zagórski Oct 19 '16 at 14:19

1 Answers1

4

The solution is to create parent container (LinearLayout with attirbute "fitsSystemWindows" = true) for ScrollView.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical">
<ScrollView
   android:id="@+id/srollView"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:fillViewport="true"
   android:fitsSystemWindows="true">
<LinearLayout
   android:id="@+id/content_layer"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical">
<RelativeLayout
   android:id="@+id/containerPhoneNumber"
   android:layout_width="match_parent"
   android:layout_height="64dp">
<EditText
   style="@style/edit_text_style"
   android:layout_width="match_parent"
   android:layout_height="64dp"
/>
...
</ScrollView>
</LinearLayout>

Thanks.

Alexei
  • 14,350
  • 37
  • 121
  • 240