如何在XML Android中绘制半边框 [英] Howto draw a half border in xml android
本文介绍了如何在XML Android中绘制半边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这样画一个边框, 边框的Edittext
I want to draw a border like this , Bordered Edittext
我的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/blue" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<!--// add android:right="5dp" and android:left="5dp" for border on left and right-->
<shape android:shape="rectangle">
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="@color/bill_background" />
</shape>
</item>
</layer-list>
我设法做到了这样:我的编辑文本
我似乎无法调整左右边框的高度.
I cant seem to adjust the height of the left and right sided borders.
推荐答案
尝试此代码!这肯定会帮助
Try this code! this will surely help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#00f" />
<padding android:bottom="2dp" />
</shape>
</item>
<item android:bottom="10dp">
<shape android:shape="rectangle" >
<solid android:color="#fff" />
<padding
android:left="2dp"
android:right="2dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#fff" />
</shape>
</item>
</layer-list>
这篇关于如何在XML Android中绘制半边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文