下面定義三個shape資源my_shape_1.xml

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

初學(xué)Android,使用Drawable資源之使用ShapeDrawa

系統(tǒng) 1994 0

ShapeDrawable比較簡單,用來定義一個基本幾何圖形,XML的根元素是<shape.../>

下面定義三個shape資源

my_shape_1.xml

?

    <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle" >
    <!-- 設(shè)置填充顏色 -->
    <solid android:color="#fff"/>
    <!-- 設(shè)置四周的內(nèi)邊距 -->
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp"/>
    <!-- 設(shè)置邊框 -->
    <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"/>
    <!-- 設(shè)置內(nèi)填充 -->
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp"/>
    <!-- 設(shè)置圓角矩形 -->
    <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"/>
    <!-- 設(shè)置內(nèi)填充 -->
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp"/>
    <!-- 設(shè)置圓角矩形 -->
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp"/>
    <!-- 設(shè)置圓角矩形 -->
    <corners android:radius="8dp"/>
</shape>
  

主界面的三個EditBox的背景分別使用上前面定義的三個shape

?

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ems="10" 
        android:background="@drawable/my_shape_1">

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/editText2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ems="10" 
        android:background="@drawable/my_shape_2"/>

    <EditText
        android:id="@+id/editText3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ems="10" 
        android:background="@drawable/my_shape_3"/>

</LinearLayout>
  

運行效果如下

初學(xué)Android,使用Drawable資源之使用ShapeDrawable資源(十五)
這樣的效果看起來怪怪的,文本框的背景被弄的亂七八糟了


初學(xué)Android,使用Drawable資源之使用ShapeDrawable資源(十五)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产成人最新毛片基地 | 神马午夜不卡片 | 午夜社区 | 毛片特级| 亚洲天堂久久 | 欧美色偷偷亚洲天堂bt | 国产片在线观看 | 2017日日干 | 亚洲日韩精品AV无码富二代 | 精品久久精品 | 精品无码久久久久久国产 | 国内精品视频在线观看 | 国产精品久久影院 | 国产三级在线视频 一区二区三区 | 天天操天天射天天舔 | 成人免费视频网站在线观看 | 久久国产高清 | 美女国内精品自产拍在线播放 | 精品视频手机在线观看免费 | 看免费大片 | 免费人成在线播放 | 亚洲精品在线第一页 | 全部免费国产潢色一级 | 精品久久久久久久久久久久久久 | 欧美激情一区二区亚洲专区 | 欧美片网站免费 | 色播基地 | 日韩成人在线播放 | 澳门特级 片免费观看视频 久草最新在线 | 欧美日韩一区二区三区自拍 | 亚洲国产天堂久久综合226 | 国产精品久久久久久免费 | 日韩欧美一区二区三区不卡 | 看了让人下面流水的视频 | 操操影视| 久久免费看 | 国产免费一区二区三区免费视频 | 好爽~好硬~好紧~蜜芽 | 一级片在线播放 | 国产日韩在线观看一区 | 成 人 片 在线观看 激情五月六月婷婷 |