Android layer-list:聯合shape(2)
附錄文章3簡單說明了Android layer-list的用法,現在把Android layer-list聯合shape做出一些特殊的應用,和附錄文章3類似,先寫布局檔案:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="zhangphil.demo.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="180dip"
android:layout_centerInParent="true"
android:background="@drawable/layer_list"
android:text="zhang phil @csdn"
android:gravity="center"
android:padding="10dip"
android:textColor="@android:color/white"/>
</RelativeLayout>
布局檔案的背景background裡面用到layer-list(drawable/ layer_list.xml):
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners
android:bottomLeftRadius="40dip"
android:bottomRightRadius="40dip"
android:topLeftRadius="5dip"
android:topRightRadius="20dip" />
<solid android:color="@android:color/holo_red_light" />
<stroke
android:width="5dip"
android:color="@android:color/holo_blue_dark" />
</shape>
</item>
<item android:drawable="@mipmap/ic_launcher"></item>
</layer-list>
代碼運作結果如圖:
附錄文章:
1,《Android AnimationDrawable動畫與APP啟動引導頁面》連結位址:
http://blog.csdn.net/zhangphil/article/details/474169152,《Android ImageView的setImageLevel和level-list使用簡介》連結位址:
http://blog.csdn.net/zhangphil/article/details/489362093,《Android layer-list(1)》連結位址:
http://blog.csdn.net/zhangphil/article/details/51720924