机器人:windowSoftInputMode =" adjustResize"不会有什么区别? [英] android:windowSoftInputMode="adjustResize" doesn't make any difference?

查看:272
本文介绍了机器人:windowSoftInputMode =" adjustResize"不会有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个虚假的对话框,使用此布局:

 < XML版本=1.0编码=UTF-8&GT?;
<的FrameLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
                机器人:layout_height =match_parent
                机器人:layout_width =match_parent
                机器人:ID =@ + ID / containerPageConatiner>

    <的FrameLayout机器人:ID =@ + ID / dialogHolder
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_width =WRAP_CONTENT
                    机器人:填充=15dp
                    机器人:layout_gravity =中心
                    机器人:背景=@可绘制/ panel_picture_frame_bg_focus_blue/>
< /的FrameLayout>
 

我把里面的一个片段<的FrameLayout> 取决于它打开对话框 - 活动控制对话框看起来是这样的:

 <活动
    机器人:标签=@字符串/ APP_NAME
    机器人:名称=。activity.DialogActivity
    机器人:主题=@风格/ CustomTheme.Screen.Transparent
    机器人:windowSoftInputMode =adjustResize>
 

不幸的是,当你点击一个编辑文本的对话里,不会进行调整发生。该 windowSoftInputMode 字面上没有什么区别的功能是一样的全景模式。

文档说:当然,这仅适用于具有可调整大小的面积应用可以减少,使有足够的空间,​​但不告诉你这是什么意思是一个可调整大小的区域,让我觉得在某些方面我的的有一个可调整大小的面积?

如果有人知道这是怎么回事他们能帮助我吗?

修改

围绕对话,像这样没有任何改变:

 < XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / containerPageConatiner
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直>

    <查看
        机器人:layout_width =0dp
        机器人:layout_height =0dp
        机器人:layout_weight =1/>

    <的FrameLayout
        机器人:ID =@ + ID / dialogHolder
        机器人:layout_height =WRAP_CONTENT
    机器人:layout_width =WRAP_CONTENT
        机器人:填充=15dp
        机器人:layout_gravity =中心
        机器人:背景=@可绘制/ panel_picture_frame_bg_focus_blue/>

    <查看
        机器人:layout_width =0dp
        机器人:layout_height =0dp
        机器人:layout_weight =1/>
< / LinearLayout中>
 

EDIT2

滚动型的父母也没有帮助:

 < XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / containerPageConatiner
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>

    <的FrameLayout
            机器人:ID =@ + ID / dialogHolder
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_gravity =中心
            机器人:填充=15dp/>

< /滚动型>
 

解决方案

我为了尝试,并获得工作的窗口大小调整的基本功能创建了一个新项目,并在慢慢地就对我的项目的目标peice的。这样做我跟踪这个问题到这一点:

在我的主题层次我有这个属性:

 <项目名称=机器人:windowFullscreen>真< /项目>
 

这是埋在 Theme.Black.NoTitleBar.FullScreen 的水平 - 我的自定义主题的祖先

借助文档表明,这是一个标志,表示此窗口是否应该填写整个屏幕。这听起来像一个好东西,如果您有一个应用程序,它占据了整个屏幕......除了它仍然占据了整个屏幕没有标志。

事实上,一旦你采取了这一点,没有在应用程序绝对没有任何改变......除了 adjustResize 现在完美的作品。

I have a faux dialog which uses this layout:

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

I place a fragment inside the <FrameLayout> depending on the dialog which is opening - The activity controlling the Dialog looks like this:

<activity
    android:label="@string/app_name"
    android:name=".activity.DialogActivity"
    android:theme="@style/CustomTheme.Screen.Transparent" 
    android:windowSoftInputMode="adjustResize">

Unfortunately when you click on an edit text inside of the dialog, no resizing takes place. The windowSoftInputMode literally makes no difference as the functionality is the same as pan mode.

Documentation says "This of course only works for applications that have a resizeable area that can be reduced to make enough space" but doesn't tell you what it means by "a resizeable area" and makes me think that in some way I don't have a resizeable area?

If anyone knows what's up can they help me out?

EDIT

Surrounding the dialog like so doesn't change anything:

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

EDIT2

Scrollview as parent doesn't help either:

<?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"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="15dp" />

</ScrollView>

解决方案

I created a new project in order to try and get the basic features working for window resizing and the slowly moved it towards the target peice of my project. Doing this I tracked the problem down to this:

In my theme hierarchy I had this property:

<item name="android:windowFullscreen">true</item> 

which was burried at the level of Theme.Black.NoTitleBar.FullScreen - An ancestor of my custom theme.

The documentation suggests that this is a "Flag indicating whether this window should fill the entire screen". That sounds like a good thing to have if you have an app which takes up the whole screen... Except it still takes up the whole screen without the flag.

In fact, once you've taken this out, there is absolutely no change in the app at all... apart from adjustResize now works perfectly.

这篇关于机器人:windowSoftInputMode =&QUOT; adjustResize&QUOT;不会有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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