• android shape的使用


    android shape的使用

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

    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" />  




    shape用于设定形状,可以在selector,layout等里面使用,有6个子标签,各属性如下:

      1. <?xml version="1.0" encoding="utf-8"?>  
      2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
      3.       
      4.     <!-- 圆角 -->  
      5.     <corners  
      6.         android:radius="9dp"  
      7.         android:topLeftRadius="2dp"  
      8.         android:topRightRadius="2dp"  
      9.         android:bottomLeftRadius="2dp"  
      10.         android:bottomRightRadius="2dp"/><!-- 设置圆角半径 -->  
      11.       
      12.     <!-- 渐变 -->  
      13.     <gradient  
      14.         android:startColor="@android:color/white"  
      15.         android:centerColor="@android:color/black"  
      16.         android:endColor="@android:color/black"  
      17.         android:useLevel="true"  
      18.         android:angle="45"  
      19.         android:type="radial"  
      20.         android:centerX="0"  
      21.         android:centerY="0"  
      22.         android:gradientRadius="90"/>  
      23.       
      24.     <!-- 间隔 -->  
      25.     <padding  
      26.         android:left="2dp"  
      27.         android:top="2dp"  
      28.         android:right="2dp"  
      29.         android:bottom="2dp"/><!-- 各方向的间隔 -->  
      30.       
      31.     <!-- 大小 -->  
      32.     <size  
      33.         android:width="50dp"  
      34.         android:height="50dp"/><!-- 宽度和高度 -->  
      35.       
      36.     <!-- 填充 -->  
      37.     <solid  
      38.         android:color="@android:color/white"/><!-- 填充的颜色 -->  
      39.       
      40.     <!-- 描边 -->  
      41.     <stroke  
      42.         android:width="2dp"  
      43.         android:color="@android:color/black"  
      44.         android:dashWidth="1dp"  
      45.         android:dashGap="2dp"/>  
      46.       
      47. </shape> 
  • 相关阅读:
    Xpath定位总结
    robotframework运行时后台报错UnicodeDecodeError
    Selenium驱动Microsoft Edge浏览器(基于robotframework框架)的方法
    robotframework自动化测试安装配置
    硬币
    矩阵乘法
    动态规划和凸性优化
    动态规划背包问题--做题小总结
    CSAPP实验attacklab
    信息学奥赛出局?教育部:若提出申请,会认真研究
  • 原文地址:https://www.cnblogs.com/mrray/p/6846882.html
Copyright © 2020-2023  润新知