xenurec xenurec - 2 months ago 22
Android Question

windowSoftInputMode="adjustResize" not working with translucent action/navbar

I have problems with the translucent actionbar/navbar in the new Android KitKat (4.4) and the

windowSoftInputMode="adjustResize"
.

Normaly changing the InputMode to adjustResize, the app should resize itself when keyboard is shown... but here it won't! If I delete the lines for the transparent effect, the resize is working.

So if the keyboard is visible, my ListView is under it and I can't access the last few items. (Only by hiding the keyboard manually)

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="XYZ"
android:versionCode="23"
android:versionName="0.1" >

<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.XYZStyle" >
<activity
android:name="XYZ"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


values-v19/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.XYZStyle" parent="@style/Theme.AppCompat.Light">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>

</resources>


fragment.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ListView
android:id="@+id/listView_contacts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0dp"
android:drawSelectorOnTop="true"
android:fastScrollAlwaysVisible="true"
android:fastScrollEnabled="true"
android:paddingBottom="@dimen/navigationbar__height" >
</ListView>

</RelativeLayout>


Anyone ideas for fixing this?

Answer

You are missing the following property:

android:fitsSystemWindows="true"

in the root RelativeLayout of the fragment.xml layout (Or possibly on the activity layout, not sure since we don't have the full structure of your app)

Comments