当前位置: 代码迷 >> Android >> 怎么给设置边框线为双线
  详细解决方案

怎么给设置边框线为双线

热度:6   发布时间:2016-04-28 06:32:04.0
如何给设置边框线为双线?
     我要把imageview的边框设置为双线,要达到图1的效果。定义的xml样式如下,结果如图2所示,但不知如何修改。请教大家,如何修改呢?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF" />
    <stroke android:width="3dp" android:color="#228B22" />
    <corners android:radius="2dp" />
    <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" />
</shape>





------解决方案--------------------
<shape 
 xmlns:android=" CodeGo.net 
 android:shape="rectangle"
 android:height="60px"
 >
 <shape 
  android:shape="rectangle" 
  android:height="30px"
  >
  <solid 
   android:color="#ff297baf" 
   />
 </shape>
 <shape 
  android:shape="rectangle"
  android:height="30px"
  >
   <gradient
 android:type="linear"
 android:startColor="#ff297baf"
 android:endColor="#ff16c0e3"
 android:angle="270"/> 
 </shape>
 <shape
  android:shape="rectangle"
  android:height="3px"
  >
  <solid 
   android:color="#FFFFFFFF"
   />
 </shape>
</shape>
------解决方案--------------------
我建议让美工做个.9的背景图效果更好点
------解决方案--------------------
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item>
        <shape>
            <solid android:color="#FFFFFFFF" />

            <stroke
                android:width="3dp"
                android:color="#228B22" />

            <corners android:radius="2dp" />

            <padding
                android:bottom="8dp"
                android:left="8dp"
                android:right="8dp"
                android:top="8dp" />
        </shape>
    </item>
    <item>
        <shape>
            <solid android:color="#FFFFFFFF" />

            <stroke
                android:width="3dp"
                android:color="#228B22" />

            <corners android:radius="2dp" />

            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />
        </shape>
    </item>

</layer-list>


PS:不建议这么做,最好是用张图片。
  相关解决方案