zoukankan      html  css  js  c++  java
  • Android 通过solid来定义不同边框的颜色,可以只定义一个边框的颜色

    以下是设置按钮的右边框和底边框颜色为红色,边框大小为3dp,如下图:

    在drawable新建一个 buttonstyle.xml的文件,内容如下:

    [html] view plaincopy
     
    1. <?xml version="1.0" encoding="UTF-8"?>  
    2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">   
    3. <!-- 连框颜色值 --><item>   
    4.       <shape>   
    5.             <solid android:color="#ff0000" />   
    6.       </shape>   
    7. </item>   
    8. <!-- 主体背景颜色值 -->  
    9. <item android:bottom="3dp" android:right="3dp">   
    10.      <shape>   
    11.            <solid android:color="#ffffff" />  
    12.              
    13.            <padding android:bottom="10dp"  
    14.                 android:left="10dp"  
    15.                 android:right="10dp"  
    16.                 android:top="10dp" />  
    17.      </shape>       
    18. </item>  
    19. </layer-list>  

    然后在布局文件里面的Button里面设置如下:

    [html] view plaincopy
     
    1. <Button  
    2.    android:id="@+id/button1"  
    3.    android:layout_width="wrap_content"  
    4.    android:layout_height="wrap_content"  
    5.    android:text="Button1"  
    6.    android:background="@drawable/buttonstyle" />  
  • 相关阅读:
    求a,b在区间上的公倍数个数
    最长非上升子序列的长度
    uva 11992 线段树
    hdu 5464 dp
    hdu 5465 树状数组
    hdu 5459 递推
    poj 2528 动态线段树
    hdu 4474 bfs
    ural 1495 bfs
    hdu 2795 线段树
  • 原文地址:https://www.cnblogs.com/bxfx111/p/3582688.html
Copyright © 2011-2022 走看看