5

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> 
4

1 回答 1

18

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

于 2013-07-31T21:00:30.837 回答