Android使用xml自定義圖片實例詳解
Android使用xml自定義圖片實例詳解
實現(xiàn)效果圖:
白色圓角圖片
bg_round_rectangle_white.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充 --> <solid android:color="#FFFFFF" /> <!-- 圓角 --> <corners android:radius="2dp"/> <!-- 描邊 --> <stroke android:width="1dp" android:color="#D5D5D5"/> </shape>
白色圓角虛線框
bg_round_rectangle_white_dash.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充 --> <solid android:color="#FFFFFF" /> <!-- 圓角 --> <corners android:radius="2dp"/> <!-- 虛線描邊 --> <stroke android:width="1dp" android:color="#DD4041" android:dashWidth="1dp" android:dashGap="2dp"/> </shape>
紅色圓角圖片
bg_round_rectangle_red.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充 --> <solid android:color="#F15C5D" /> <!-- 圓角 --> <corners android:radius="2dp"/> <!-- 描邊 --> <stroke android:width="1dp" android:color="#D42D2E"/> </shape>
綠色圓角圖片
bg_round_rectangle_green.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充 --> <solid android:color="#88C14E" /> <!-- 圓角 --> <corners android:radius="2dp"/> <!-- 描邊 --> <stroke android:width="1dp" android:color="#6FA13C"/> </shape>
正三角形圖片
triangle_white_arrow_up.xml
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="45" android:toDegrees="45" android:pivotX="-40%" android:pivotY="80%"> <shape android:shape="rectangle"> <solid android:color="#000000"/> </shape> </rotate>
倒立正三角形圖片
triangle_white_arrow_down.xml
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="45" android:toDegrees="45" android:pivotX="135%" android:pivotY="15%"> <shape android:shape="rectangle"> <solid android:color="#000000"/> </shape> </rotate>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
Android添加圖片到ListView或者RecyclerView顯示
這篇文章主要介紹了Android添加圖片到ListView或者RecyclerView顯示的相關資料,需要的朋友可以參考下2016-08-08Android開發(fā)實現(xiàn)讀取Assets下文件及文件寫入存儲卡的方法
這篇文章主要介紹了Android開發(fā)實現(xiàn)讀取Assets下文件及文件寫入存儲卡的方法,涉及Android文件與目錄的讀取、寫入、轉換等相關操作技巧,需要的朋友可以參考下2017-10-10Android開發(fā)中ProgressDialog簡單用法示例
這篇文章主要介紹了Android開發(fā)中ProgressDialog簡單用法,結合實例形式分析了Android使用ProgressDialog的進度條顯示與關閉、更新等事件響應相關操作技巧,需要的朋友可以參考下2017-10-10android教程之textview解析帶圖片的html示例
本文介紹的示例適用于android中需要解析帶圖片的htlm數(shù)據(jù),需要的朋友可以參考下2014-02-02