在EditText上横向模式影像边界不工作 [英] landscape mode border image in edittext not working
问题描述
您可以参考<一个href=\"http://wptrafficanalyzer.in/blog/changing-background-color-and-border-color-of-an-edittext-widget-using-state-list-in-android/\"相对=nofollow>这个 code。
编辑文本的边框颜色设置为某个颜色。
在portratait模式下正常工作。
为什么我无法看到landsacpe模式相同的颜色/图像??在风景模式下功能键是打开的,然后编辑文本颜色变成红色(默认)..我在哪里可以找到红色边框可扩展的图像?
纽约想法??
下面是我的布局文件
&LT;?XML版本=1.0编码=UTF-8&GT?;
&LT; LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直&GT; &LT;的EditText
机器人:ID =@ + ID / EDIT1
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ edit1_text
安卓的inputType =TEXT
机器人:背景=@绘制/ edit_text /&GT; &LT;的EditText
机器人:ID =@ + ID / EDIT2
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/ edit2_text
安卓的inputType =TEXT
机器人:背景=@绘制/ edit_text /&GT;
&LT; / LinearLayout中&GT;
和这里是@绘制/ edit_text文件code
&LT;?XML版本=1.0编码=UTF-8&GT?;
&LT;选择的xmlns:机器人=http://schemas.android.com/apk/res/android&GT;
&LT;项目
机器人:state_window_focused =假
机器人:state_enabled =真
机器人:可绘制=@绘制/ textfield_default/&GT;
&LT;项目
机器人:state_window_focused =假
机器人:state_enabled =假
机器人:可绘制=@绘制/ textfield_disabled/&GT;
&LT;项目
机器人:STATE_ pressed =真
机器人:可绘制=@绘制/ textfield_ pressed/&GT;
&LT;项目
机器人:state_enabled =真
机器人:state_focused =真
机器人:可绘制=@绘制/ textfield_selected/&GT;
&LT;项目
机器人:state_enabled =真
机器人:可绘制=@绘制/ textfield_default/&GT;
&LT;项目
机器人:state_focused =真
机器人:可绘制=@绘制/ textfield_disabled_selected/&GT;
&LT;项目
机器人:可绘制=@绘制/ textfield_disabled/&GT;
&LT; /选择&GT;
@ Mr.Singh - 当我在设备中执行你的code,我正在编辑文本边框即使是在景观mode.Please检查...
you can refer to this code.
Border color of Edit Text is set to some color. working fine in portratait mode. Why i can't see the same color/image in landsacpe mode??In landscape mode when soft key is open then edit text color become red(default)..where can i locate that red border scalable image?? ny idea??
below is my layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/edit1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/edit1_text"
android:inputType="text"
android:background="@drawable/edit_text"
/>
<EditText
android:id="@+id/edit2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/edit2_text"
android:inputType="text"
android:background="@drawable/edit_text"
/>
</LinearLayout>
and here is @drawable/edit_text file code
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_window_focused="false"
android:state_enabled="true"
android:drawable="@drawable/textfield_default" />
<item
android:state_window_focused="false"
android:state_enabled="false"
android:drawable="@drawable/textfield_disabled" />
<item
android:state_pressed="true"
android:drawable="@drawable/textfield_pressed" />
<item
android:state_enabled="true"
android:state_focused="true"
android:drawable="@drawable/textfield_selected" />
<item
android:state_enabled="true"
android:drawable="@drawable/textfield_default" />
<item
android:state_focused="true"
android:drawable="@drawable/textfield_disabled_selected" />
<item
android:drawable="@drawable/textfield_disabled" />
</selector>
@Mr.Singh - When I executed your code in my device, I am getting edit text border even in landscape mode.Please check....
这篇关于在EditText上横向模式影像边界不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!