相关疑难解决方法(0)

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万
查看次数

Coordinatorlayout adjustresize不起作用

我的代码(以及更多): 我有一个协调员布局如下

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapse_toolbar"
            android:layout_width="match_parent"
            android:layout_height="280dp"
            android:fitsSystemWindows="true"
            app:contentScrim="@color/transparent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <include layout="@layout/top" /> <!-- A RelativeLayout -->

            <android.support.v7.widget.Toolbar
                android:id="@+id/MyToolbar"
                android:layout_width="match_parent"
                android:layout_height="64dp"
                app:layout_collapseMode="parallax">

            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <!-- Main content here -->

    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

在框架布局中,我正在使用位于底部的编辑文本为自定义视图充气.编辑文本和自定义视图显示正常.

我在清单中定义了android:windowSoftInputMode ="adjustResize | stateHidden".

我的问题: 在点击编辑文本以调出软键盘时,它会重叠下面的内容而不是调整FrameLayout的大小.当软键盘出现时,我无法让FrameLayout调整大小.任何帮助将不胜感激

我试过的事:

  1. 更新了22.2.1的设计支持库
  2. 添加了android:layout_gravity ="fill_vertical"作为FrameLayout中的属性.

android android-softkeyboard adjustpan android-coordinatorlayout

21
推荐指数
5
解决办法
8299
查看次数