Mat*_*adt 6 android android-manifest
Android如何确定在显示软键盘时是否移动布局?
注意:我知道活动属性android:windowSoftInputMode="adjustResize|adjustResize|adjustUnspecified"
存在,如http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft所述
,但在我的情况下它似乎没有任何属性影响.这是我的问题:
我有两个活动,几乎相同的布局,但第一个是使用ListView,其中包含按钮列表.第二个活动包含带按钮的滚动视图.其余是相同的,相同数量的按钮,相同的元素高度等.
现在,当我按下搜索按钮打开搜索输入栏时,在我的第一个活动中,整个布局都会向上移动. 在第二个活动中,布局没有向上移动,但软键盘只显示在它上面.这实际上就是我希望它的表现方式.我如何通过使用ListView的活动实现相同的目标?
在我的清单中,最初我没有指定任何android:windowSoftInputMode属性,但即使我这样做,也没有任何区别; 我尝试了所有三个值(adjustPan,adjustResize,adjustUndefined,没有任何区别).
这是我的布局:
1)http://pastebin.com/5zzVxjbK
2)http://pastebin.com/KFtPuHvP
有趣的是:当我在我的布局1(左)中将ListView可见性设置为View.INVISIBLE时,布局不会向上移动!

我可以通过relativelayout和设置来实现这一点,android:windowSoftInputMode="adjustPan"如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" >
<include android:id="@+id/Header" layout="@layout/header"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ListView android:id="@+id/android:list" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="@id/Header"
android:layout_above="@+id/Footer" />
<include android:id="@id/Footer" layout="@layout/footer"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
如果您想保留 LinearLayout,您可以通过将页脚重力(或layout_gravity)设置为“bottom”来实现此目的,但我不确定。
| 归档时间: |
|
| 查看次数: |
3724 次 |
| 最近记录: |