Android的布局,如何让如CSS半径和边框 [英] Android Layout, how to make a radius and border like css
本文介绍了Android的布局,如何让如CSS半径和边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要做一些这样想在android系统布局的背景下,有什么解决办法吗?
I want to make some think like this in android layout background, is there any solution ?
我有2个边界,一个在顶部,另一个是底部,他们有不同的颜色,而且我不希望有任何边框左侧和右侧
CSS code是:
CSS Code is:
#shape{
border-radius : 2px;
border-top : 1px solid #070709;
border-bottom : 1px #383841;
/*...*/
}
注意:边境有半径过
推荐答案
创建绘制文件夹中的XML,并把这个code它:
Create an XML in drawable folder and put this code in it:
<?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="@android:color/darker_gray" />
<corners android:radius="5dp" />
</shape>
</item>
<item android:top="3dp">
<shape android:shape="rectangle" >
<solid android:color="#383841" />
<corners android:radius="5dp" />
</shape>
</item>
<item
android:bottom="3dp"
android:top="3dp">
<shape android:shape="rectangle" >
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
这层列表包含3项
1:带圆角顶部颜色。
2:带圆角底部的颜色。
3:在视图其余颜色
This layer list contains 3 items 1: color on top with round corners. 2: color on bottom with round corners. 3: color on rest of the view.
您可以设置此为背景的任何视图。
You can set this as background to any view.
这篇关于Android的布局,如何让如CSS半径和边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文