zoukankan      html  css  js  c++  java
  • 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> 
  • 相关阅读:
    linux反汇编
    Java中UML图
    Java设计模式_创建型模式_单例模式
    Javadoc注释的用法
    VIM使用技巧1
    手动破解的 Linux下的Maltab 2014b
    让vim的在输入模式下现实光标不同
    Vim 自动补全成对的括号和引号
    MAMP:在 OSX 中搭建 Apache, MySQL, PHP 环境并本地安装、调试 WordPress
    MAC+iTerm定制目录显示颜色和提示符
  • 原文地址:https://www.cnblogs.com/mrray/p/6846882.html
Copyright © 2011-2022 走看看