Android layer-list:联合shape(2)

简介: Android layer-list:联合shape(2)附录文章3简单说明了Android layer-list的用法,现在把Android layer-list联合shape做出一些特殊的应用,和附录文章3类...



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/47416915 
2,《Android ImageView的setImageLevel和level-list使用简介》链接地址:http://blog.csdn.net/zhangphil/article/details/48936209
3,《Android layer-list(1)》链接地址:http://blog.csdn.net/zhangphil/article/details/51720924

相关文章
|
XML Android开发 数据格式
Android MaterialButton使用详解,告别shape、selector
Android MaterialButton使用详解,告别shape、selector
318 0
Android MaterialButton使用详解,告别shape、selector
|
9月前
|
XML Android开发 数据格式
Android中利用shape属性自定义设置Button按钮
Android中利用shape属性自定义设置Button按钮
149 0
|
5月前
|
Android开发
[Android]Shape Drawable
[Android]Shape Drawable
47 0
|
10月前
|
存储 JavaScript 数据可视化
Android自动生成Shape资源文件,迈出可视化脚手架第一步(上)
这章我们就进入到了撸码时刻,逐步来开发出一个一个应对我们Android场景的功能,这章对应的功能是,Shape的自动生成
103 0
|
9月前
|
Android开发
Android Shape 详细使用
Android Shape 详细使用
64 0
|
10月前
|
数据可视化 Android开发
Android自动生成Shape资源文件(下)
这个Shape,在正常的开发中,无非就是,实心的,空心的,渐变的,左上右下带角度的,那么针对常见的几种方式,我们做好模板,然后根据你在可视化工具的选择,动态的进行改变即可。
Android自动生成Shape资源文件(下)
|
10月前
|
编解码 Android开发
|
10月前
|
XML 前端开发 Android开发
|
12月前
|
XML 前端开发 Android开发
Android 实现圆弧背景(Shape实现和自定义View)
如今Android系统的App,很多时候为了有更好的用户体验,都会有各种好看的UI,动画,点击效果等等,其中圆弧的控件在App中很常见,今儿就自己总结下自己实现圆弧的两种基础的方法。即Shape方法和使用View里面的方法自己画。
|
12月前
|
XML Android开发 数据格式
Android shape的用法详解
Android shape的用法详解
Android shape的用法详解