windowSoftInputMode =" adjustResize"不工作半透明的动作/导航栏动作、工作、windowSoftInputMode、QUOT

2023-09-12 04:00:47 作者:奈何橋畔,彼岸花開

我有问题,半透明的动作条/导航栏在新的Andr​​oid奇巧(4.4)和 windowSoftInputMode =adjustResize

I have problems with the translucent actionbar/navbar in the new Android KitKat (4.4) and the windowSoftInputMode="adjustResize".

Normaly改变INPUTMODE到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.

因此​​,如果键盘是可见的,我的ListView下它,我无法访问的最后几个项目。 (只有手动隐藏键盘)

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中

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>

值-V19 / styles.xml

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之

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?

推荐答案

您缺少以下属性:

android:fitsSystemWindows="true"

在根 RelativeLayout的的fragment.xml之布局(或可能对活动的布局,不知道,因为我们没有您的应用程序的完整结构)

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)