zoukankan      html  css  js  c++  java
  • ShapeDrawable 资源

    ShapeDrawable 用于定义一个基本的几何图形(如矩形、圆形、线条等),定义 ShapeDrawable 的 XML 文件的根元素是<shape.../>元素,该元素可指定如下属性。
    示例:
    main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <EditText
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:background="@drawable/my_shape_1"
        />
    <EditText
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:background="@drawable/my_shape_2"
        />    
    <EditText
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:background="@drawable/my_shape_3"
        />
    </LinearLayout>
    my_shape_1.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <!-- 设置填充颜色 -->
        <solid android:color="#fff"/>
        <!-- 设置四周的内边距 -->
        <padding android:left="7dp" 
            android:top="7dp" 
            android:right="7dp" 
            android:bottom="7dp" />
        <!-- 设置边框 -->
        <stroke android:width="3dip" android:color="#ff0" />
    </shape>
    my_shape_2.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shape="rectangle">
        <!-- 定义填充渐变颜色 -->
        <gradient 
            android:startColor="#FFFF0000" 
            android:endColor="#80FF00FF" 
            android:angle="45"/> 
        <!-- 设置内填充 -->
        <padding android:left="7dp" 
            android:top="7dp" 
            android:right="7dp" 
            android:bottom="7dp" />
        <!-- 设置圆角矩形 -->
        <corners android:radius="8dp" /> 
    </shape>
    my_shape_3.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shape="oval">
        <!-- 定义填充渐变颜色 -->
        <gradient 
            android:startColor="#ff0" 
            android:endColor="#00f" 
            android:angle="45"
            android:type="sweep"/> 
        <!-- 设置内填充 -->
        <padding android:left="7dp" 
            android:top="7dp" 
            android:right="7dp" 
            android:bottom="7dp" />
        <!-- 设置圆角矩形 -->
        <corners android:radius="8dp" /> 
    </shape>
     
     
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    GZOI 2017配对统计 树状数组
    关于线段树的一些问题
    BZOJ 压力 tarjan 点双联通分量+树上差分+圆方树
    洛谷4552 差分
    洛谷5026 Lycanthropy 差分套差分
    【锁】MySQL和Oracle行锁比较
    oracle体系结构
    【加密】RSA验签及加密
    【Shiro】SpringBoot集成Shiro
    【Eureka】实现原理
  • 原文地址:https://www.cnblogs.com/AndyGe/p/3436865.html
Copyright © 2011-2022 走看看