android UI布局

一、设置反复背景

在drawable目录下建一个mybackground.xml文件
在文件里写入:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/mybg_img"
    android:tileMode="repeat"/>

tileMode 属性就是用于定义背景的显示模式: 

        disabled 默认值。表示不使用平铺

        clamp 复制边缘色彩

        repeat X、Y 轴进行反复图片显示,也就是我们说要说的平铺 

        mirror 在水平和垂直方向上使用交替镜像的方式反复图片的绘制


二、使用layer-list组合图片

相同的在drawable目录下建一个mylayerlist.xml文件

在文件里写入:

<?

xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 

<item> 

    <bitmap android:src="@drawable/sms_top_bg" 

        android:gravity="center"/> 

</item> 

<item> 

<bitmap android:src="@drawable/sms_list_selected_arrow" 

android:gravity="right"/

posted @ 2017-07-25 15:48  zsychanpin  阅读(198)  评论(0编辑  收藏  举报