windowSoftInputMode="adjustResize";不使用半透明动作/导航栏 [英] windowSoftInputMode="adjustResize" not working with translucent action/navbar

查看:41
本文介绍了windowSoftInputMode="adjustResize";不使用半透明动作/导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在新的 Android KitKat (4.4) 和 windowSoftInputMode=adjustResize" 中的半透明操作栏/导航栏有问题.

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

通常,将 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:

<?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

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>

片段.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>

有解决这个问题的想法吗?

Any ideas for fixing this?

推荐答案

您缺少以下属性:

android:fitsSystemWindows="true"

fragment .xml 布局的根 RelativeLayout 中.

in the root RelativeLayout of the fragment .xml layout.

更新:

去年 Chris Bane 进行了一次有趣的演讲,详细解释了这是如何工作的:

Last year there was an interesting talk by Chris Bane that explains in good detail how this works:

https://www.youtube.com/watch?v=_mGDMVRO3iE

这篇关于windowSoftInputMode="adjustResize";不使用半透明动作/导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆