android - Padding error with fitsSystemWindows on Kitkat -


i trying use kitkat's transparent navigation bars feature, , weird effect:

padding seems added bottom of view when add fitssystemwindows attribute true. attribute added first view doesn't align top , displayed behind status bar.

this want , expect: enter image description here

but get: enter image description here

i tested textviews well, same result. can't work, guess i'm missing something.

below code:

file values-19/styles.xml:

<style name="apptheme" parent="android:theme.holo.noactionbar.translucentdecor"> </style> 

my layout file:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#800"     android:orientation="vertical" >      <imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="#80f0"         android:fitssystemwindows="true"         android:src="@drawable/ic_launcher" />      <imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="#800f"         android:src="@drawable/ic_launcher" />  </linearlayout> 

you should put android:fitssystemwindows on linearlayout instead of imageview.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#800"     android:orientation="vertical"     android:fitssystemwindows="true" >      <imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="#80f0"                 android:src="@drawable/ic_launcher" />      <imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="#800f"         android:src="@drawable/ic_launcher" />  </linearlayout> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -