如何改变相对布局边框颜色? [英] how to change relative layout border color?
问题描述
如何改变相对布局边框颜色?这是我的code以下我只是想表明边框颜色黑,但显示所有相对布局黑色。我只是想表明相对布局白色只有伯德将是黑色的我该怎么办?
< RelativeLayout的
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@可绘制/ border5>
< XML版本=1.0编码=UTF-8&GT?;
<层列表的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目>
<形机器人:形状=矩形>
[固体机器人:颜色=#000000/>
< /形状>
< /项目>
<项目的android:左=1DP机器人:顶部=1DP安卓底=2DP>
<形机器人:形状=矩形>
< /形状>
< /项目>
< /层列表>
这是我给我的一个白色背景
和橙色边框
<形状的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:形状=矩形>
[固体机器人:颜色=@可绘制/白/>
<中风
机器人:宽=的3px
机器人:颜色=@可绘制/橙色/>
< /形状>
如果你单纯只是想有一个边界,那么你可以把它都在同一个<形状>
和使用 [固体... >
为背景
颜色(如果你想给它一个),<中风...>
的边界。
您可以做到这一点,你怎么把它只是改变了<你想
到背景
颜色;固体GT并添加<中风>
加黑
how to change relative layout border color?? this is my code below i just want to show border color black but is show all relative layout black. i just want to show relative layout white color only borde will be black what will i do??
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/border5">
<?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="#000000" />
</shape>
</item>
<item android:left="1dp" android:top="1dp" android:bottom="2dp" >
<shape android:shape="rectangle">
</shape>
</item>
</layer-list>
This is how I give mine a white background
and orange border
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@drawable/white" />
<stroke
android:width="3px"
android:color="@drawable/orange" />
</shape>
If you simply just want a border then you can keep it all in the same <shape>
and use <solid...>
for the background
color (if you want to give it one) and <stroke...>
for the border.
You can do it how you have it just change the <solid>
to the background
color you want and add the <stroke>
with black
这篇关于如何改变相对布局边框颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!