在绘制XML一个机器人视图创建边界,三面? [英] Create borders on a android view in drawable xml, on 3 sides?
本文介绍了在绘制XML一个机器人视图创建边界,三面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打一个绘制为我的Android按键,定义为绘制。我发现我可以用一个矩形设置所有的边界,但我有点卡住时,我想它的三面。我想例如具有的顶部或底部开口。
I want to make a drawable for my Android button, defined as drawable. I found I could set all the borders by using a rectangle, but I got kinda stuck when I wanted it on three sides. I want for example have either the top or the bottom open.
谁能告诉我如何做到这一点?
Could anyone show me how to do this?
推荐答案
尝试这样做,但我看到了它的一些其他职位
Try doing this, though I saw it on some other post
<?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="#FFFFFF" />
<padding
//android:bottom="10dp" Remove this to avoid seeing the bottom border
android:left="10dp"
android:right="10dp"
//android:top="10dp" Remove this to avoid seeing the top border
/>
<corners android:radius="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="#666666" />
</shape>
</item>
</layer-list>
<一个href="http://stackoverflow.com/a/10133434/1244489">http://stackoverflow.com/a/10133434/1244489
这篇关于在绘制XML一个机器人视图创建边界,三面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文