相关疑难解决方法(0)

windowSoftInputMode ="adjustResize"不适用于半透明动作/导航栏

我在新的Android KitKat(4.4)中使用半透明操作栏/导航栏时出现问题windowSoftInputMode="adjustResize".

Normaly将InputMode更改为adjustResize,应用程序应该在键盘显示时自行调整大小......但是在这里它不会!如果我删除透明效果的行,则调整大小正常.

因此,如果键盘可见,我的ListView就在它下面,我无法访问最后几个项目.(只能手动隐藏键盘)

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>
Run Code Online (Sandbox Code Playgroud)

值-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>
Run Code Online (Sandbox Code Playgroud)

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> …
Run Code Online (Sandbox Code Playgroud)

android resize statusbar window-soft-input-mode android-4.4-kitkat

117
推荐指数
8
解决办法
8万
查看次数

android:windowSoftInputMode ="adjustResize"没有任何区别?

我有一个使用这种布局的虚假对话框:

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

    <FrameLayout    android:id="@+id/dialogHolder"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:padding="15dp"
                    android:layout_gravity="center"
                    android:background="@drawable/panel_picture_frame_bg_focus_blue"/>    
</FrameLayout> 
Run Code Online (Sandbox Code Playgroud)

<FrameLayout>根据打开的对话框放置一个片段- 控制Dialog的活动如下所示:

<activity
    android:label="@string/app_name"
    android:name=".activity.DialogActivity"
    android:theme="@style/CustomTheme.Screen.Transparent" 
    android:windowSoftInputMode="adjustResize">
Run Code Online (Sandbox Code Playgroud)

不幸的是,当您单击对话框内的编辑文本时,不会进行大小调整.在windowSoftInputMode字面上没有什么区别的功能是一样的全景模式.

文档说"这当然只适用于具有可调整区域的应用程序,可以缩小以留出足够的空间",但不会告诉您"可调整区域"的含义,并让我认为在某种程度上我喜欢Ť有一个可调整大小的面积?

如果有人知道什么事可以帮助我吗?

编辑

如此围绕对话框不会改变任何东西:

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

    <View
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <FrameLayout    
        android:id="@+id/dialogHolder"
        android:layout_height="wrap_content"
    android:layout_width="wrap_content"
        android:padding="15dp"
        android:layout_gravity="center"
        android:background="@drawable/panel_picture_frame_bg_focus_blue"/>

    <View
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="1" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

EDIT2

Scrollview作为父级也无济于事:

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

    <FrameLayout
            android:id="@+id/dialogHolder"
            android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-keypad android-layout android-input-method

28
推荐指数
2
解决办法
4万
查看次数