Android自定义编辑文本通过键盘打开和关闭调整大小
我为我的EditText字段实现了一个自定义背景,因为我认为EditText的默认值太高&填充太多。无论如何,新的EditText可绘制背景显示得很好,但是当我打开键盘时,字段会略微缩小,当我关闭键盘时,字段会扩展到其原始(自定义)大小。这种行为必须以某种方式被覆盖,我只是没有偶然发现。有人能帮忙吗?我在dev android站点上读过IMEOptions文章,没有什么东西能真正让我想到这个问题的可能解决方案。谢谢Android自定义编辑文本通过键盘打开和关闭调整大小,android,android-edittext,Android,Android Edittext,我为我的EditText字段实现了一个自定义背景,因为我认为EditText的默认值太高&填充太多。无论如何,新的EditText可绘制背景显示得很好,但是当我打开键盘时,字段会略微缩小,当我关闭键盘时,字段会扩展到其原始(自定义)大小。这种行为必须以某种方式被覆盖,我只是没有偶然发现。有人能帮忙吗?我在dev android站点上读过IMEOptions文章,没有什么东西能真正让我想到这个问题的可能解决方案。谢谢 这是我的EditText-每个EditText都有自己的布局,因为我需要在字段之
这是我的EditText-每个EditText都有自己的布局,因为我需要在字段之间添加填充:
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:orientation="vertical" android:paddingBottom="5dip" android:paddingLeft="3dip" android:paddingRight="3dip">
<EditText android:id="@+id/join_firstName"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="@drawable/joinedittextselector" android:padding="5dip" /> <!-- android:layout_weight="1" -->
</LinearLayout>
这是我的选择:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/join_field_bg_default" />
<item android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/join_field_bg_default" />
<item android:state_pressed="true" android:drawable="@drawable/join_field_bg_default" />
<item android:state_enabled="true" android:state_focused="true"
android:drawable="@drawable/join_field_bg_selected" />
<item android:state_enabled="true" android:drawable="@drawable/join_field_bg_default" />
<item android:state_focused="true" android:drawable="@drawable/join_field_bg_selected" />
<item android:drawable="@drawable/join_field_bg_default" />
我尝试了adjustResize和adjustPan,用于EditText使用的活动的android:WindowsOfInputMode设置,但两者都不起作用。再次感谢您对这方面的任何建议 您可能必须为xml资源中定义它们的各种状态提供图像。人们经常这样做按钮。附加一个屏幕抓图来显示问题如何?“每个编辑文本都有自己的布局,因为我需要在字段之间添加填充”-使用
android:layout\u margin*
。这肯定更有意义。谢谢