标签:res 布局 兴趣 ace load soft 左右 src 使用
下面小巫花点时间逐个给大家介绍一下这些图像资源的用法:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@[package:]drawable/drawable_resource" android:antialias=["true" | "false"] android:dither=["true" | "false"] android:filter=["true" | "false"] android:gravity=["top" | "bottom" | "left" | "right" | "center_vertical" | "fill_vertical" | "center_horizontal" | "fill_horizontal" | "center" | "fill" | "clip_vertical" | "clip_horizontal"] android:mipMap=["true" | "false"] android:tileMode=["disabled" | "clamp" | "repeat" | "mirror"] />
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/logo" android:tileMode="repeat" > </bitmap>
这就是draw9patch.bat这个工具的作用。
<?xml version="1.0" encoding="utf-8"?效果图例如以下:> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/res" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/res" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/nine_patch" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:dither="false" android:src="@drawable/nine_patch" > </nine-patch>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/xml_ninepatch" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:gravity="center" android:src="@drawable/logo" /> </item> <item android:left="10dp" android:top="10dp"> <bitmap android:gravity="center" android:src="@drawable/logo" /> </item> <item android:left="20dp" android:top="20dp"> <bitmap android:gravity="center" android:src="@drawable/logo" /> </item> </layer-list>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/layers" /> </LinearLayout>
标签:res 布局 兴趣 ace load soft 左右 src 使用
原文地址:http://www.cnblogs.com/llguanli/p/7091117.html