android:windowSoftInputMode="adjustResize";没有任何区别? [英] android:windowSoftInputMode="adjustResize" doesn't make any difference?
问题描述
我有一个使用这种布局的人造对话框:
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">
不幸的是,当您单击对话框内的编辑文本时,不会发生大小调整.windowSoftInputMode
字面上没有区别,因为功能与平移模式相同.
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?
编辑
像这样围绕对话框不会改变任何东西:
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>
隐藏在 Theme.Black.NoTitleBar.FullScreen
级别 - 我的自定义主题的祖先.
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.
事实上,一旦你把它去掉,应用程序就完全没有任何变化......除了 adjustResize
现在可以完美运行.
In fact, once you've taken this out, there is absolutely no change in the app at all... apart from adjustResize
now works perfectly.
这篇关于android:windowSoftInputMode="adjustResize";没有任何区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!