`
ableouou
  • 浏览: 72557 次
  • 性别: Icon_minigender_2
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

软键盘弹出挤压画面的问题

阅读更多
情况,在页面的下方有一排按钮,上面分别是textview,listview:代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:background="@drawable/blacklist_spam_bg" android:orientation="vertical">




<TextView android:id="@+id/TextView01" android:layout_height="38dip"
android:background="@drawable/blacklist_spam_title" android:gravity="center_vertical"
android:layout_width="match_parent" android:text="@string/able_blacklist_title_spam"
android:textSize="18sp" android:textColor="#ff000000"></TextView>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="match_parent" android:layout_height="370dip">
<ListView android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/lv_spam_number"
android:background="#ffffffff" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>


<LinearLayout android:id="@+id/LinearLayout02"
android:layout_height="wrap_content" android:layout_marginTop="5dip"
android:layout_width="match_parent">
<Button android:layout_marginLeft="8dip" android:layout_width="86dip"
android:id="@+id/btn_spam_add" android:background="@drawable/blacklist_spam_add_effect"
android:layout_height="41dip"></Button>
<Button android:id="@+id/btn_spam_import" android:layout_width="86dip"
android:layout_height="41dip" android:layout_marginLeft="18dip"
android:background="@drawable/blacklist_spam_import_effect"></Button>
<Button android:layout_marginLeft="18dip" android:layout_width="86dip"
android:id="@+id/btn_spam_delete_all" android:background="@drawable/blacklist_spam_delete_all_effect"
android:layout_height="41dip"></Button>

</LinearLayout>
</LinearLayout>


并且我们设置该activity的属性为:android:windowSoftInputMode="adjustPan"
存在问题,长按menu时,会弹出软键盘,并且,在listview中的第6第7项也就是接近软键盘弹出的上边缘的时候会存在抖动问题。

解决方法:把 activity的属性设置为:android:windowSoftInputMode="stateHidden|adjustResize" OK

附上说明:

"stateUnspecified"

软键盘的状态 (是否它是隐藏或可见 )没有被指定。系统将选择一个合适的状态或依赖于主题的设置。

这个是为了软件盘行为默认的设置。

"stateUnchanged"

软键盘被保持无论它上次是什么状态,是否可见或隐藏,当主窗口出现在前面时。

"stateHidden"

当用户选择该 Activity时,软键盘被隐藏——也就是,当用户确定导航到该 Activity时,而不是返回到它由于离开另一个 Activity。

"stateAlwaysHidden"

软键盘总是被隐藏的,当该 Activity主窗口获取焦点时。

"stateVisible"

软键盘是可见的,当那个是正常合适的时 (当用户导航到 Activity主窗口时 )。

"stateAlwaysVisible"

当用户选择这个 Activity时,软键盘是可见的——也就是,也就是,当用户确定导航到该 Activity时,而不是返回到它由于离开另一个 Activity。

"adjustUnspecified"

它不被指定是否该 Activity主 窗口调整大小以便留出软键盘的空间,或是否窗口上的内容得到屏幕上当前的焦点是可见的。系统将自动选择这些模式中一种主要依赖于是否窗口的内容有任何布局 视图能够滚动他们的内容。如果有这样的一个视图,这个窗口将调整大小,这样的假设可以使滚动窗口的内容在一个较小的区域中可见的。这个是主窗口默认的行为 设置。

"adjustResize"

该 Activity主窗口总是被调整屏幕的大小以便留出软键盘的空间

"adjustPan"

该 Activity主窗口并不调整屏幕的大小以便留出软键盘的空间。相反,当前窗口的内容将自动移动以便当前焦点从不被键盘覆盖和用户能总是看到输入内容的部分。这个通常是不期望比调整大小,因为用户可能关闭软键盘以便获得与被覆盖内容的交互操作。


分享到:
评论
3 楼 kondoh 2012-02-28  
来回复制粘贴的
2 楼 ableouou 2011-09-05  
fish007fish2003 写道
我的布局里面也有listview,遇到了同样地问题,用了你说的方法还是不行,求指教。

具体说说
1 楼 fish007fish2003 2011-08-29  
我的布局里面也有listview,遇到了同样地问题,用了你说的方法还是不行,求指教。

相关推荐

Global site tag (gtag.js) - Google Analytics