zoukankan      html  css  js  c++  java
  • Android layer-list(1)

    

    Android layer-list(1)

    Android layer-list,顾名思义,实现列表组合后形成的图层,写一个例子。
    activity_main.xml文件:

    <?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="150dip"
            android:layout_centerInParent="true"
            android:background="@drawable/layer_list"
            android:text="zhang phil @csdn"
            android:gravity="center"
            android:textColor="@android:color/white"/>
    
    </RelativeLayout>
    


    其中TextView 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 android:drawable="@android:color/holo_red_light"></item>
        <item android:drawable="@mipmap/ic_launcher"></item>
    
    </layer-list>
    注意layer-list里面定义的item元素的先后顺序,后者将直接覆盖在前者上面,一层一层覆盖。


    代码运行结果:


    附录文章:
    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


  • 相关阅读:
    fiddler抓取java系程序的网络通信
    ZOJ 2724 Windows Message Queue(优先队列)
    FZU 电动车通行证制度
    Havel定理
    Catch That Cow
    Trie树
    zoj 2876 Phone List
    zoj 2420
    getchar
    zoj 1315 Excuses, Excuses!
  • 原文地址:https://www.cnblogs.com/hehehaha/p/6147305.html
Copyright © 2011-2022 走看看