我已经定制设计的一个编辑文字
search_page.xml
<的LinearLayout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=横向
机器人:填充=10dp
机器人:后台=#E1E1E1
机器人:weightSum =1>
<的TextView
机器人:layout_width =0dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =25
机器人:文本=城市/>
<的EditText
机器人:layout_width =0dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =10dp
机器人:背景=@可绘制/ rounded_edittext
75:机器人layout_weight = />
< / LinearLayout中>
rounded_edittext.xml
< XML版本=1.0编码=UTF-8&GT?;
<! - RES /绘制/ rounded_edittext.xml - >
<形状的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:填充=10dp
机器人:形状=矩形>
[固体机器人:颜色=#FFFFFF/>
<角落
机器人:bottomLeftRadius =10dp
机器人:bottomRightRadius =10dp
机器人:topLeftRadius =10dp
机器人:topRightRadius =10dp/>
< /形状>
我想使用的颜色code #2f6699
可以得到这样一个轮廓EIT文本框,如下
任何想法...就如何实现这一目标
解决方案使用下面的code在 rounded_edittext.xml
< XML版本=1.0编码=UTF-8&GT?;
<形状的xmlns:机器人=http://schemas.android.com/apk/res/android>
[固体机器人:颜色=#FFFFFF/>
<中风
机器人:宽=1DP
机器人:颜色=#2f6699/>
<角落
机器人:topLeftRadius =10dp
机器人:topRightRadius =10dp
机器人:bottomLeftRadius =10dp
机器人:bottomRightRadius =10dp
/>
< /形状>
这应该工作
I have custom designed a Edit text
search_page.xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:background="#E1E1E1"
android:weightSum="1" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="City" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/rounded_edittext"
android:layout_weight=".75" />
</LinearLayout>
rounded_edittext.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>
I want to use colour code #2f6699
to get a border color like a outline to eit text box as below
Any Ideas ... on how to achieve this
解决方案Use the below code in your rounded_edittext.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#2f6699" />
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
/>
</shape>
This should work