鉴客 Android 背景图片重复 Background repeat
来源:互联网 发布:在北京做程序员好吗 编辑:程序博客网 时间:2024/04/30 02:17
以LinearLayout为例,它提供的background属性将会将背景图片拉伸,相当难看。事实上我们只需做少量的修改就可以实现web编程中css背景图片的效果。来试试吧。
Bitmap介绍
A Drawable that wraps a bitmap and can be tiled, stretched, or aligned. You can create a BitmapDrawable from a file path, an input stream, through XML inflation, or from a Bitmap object.
属性 android:tileMode
Defines the tile mode. When the tile mode is enabled, the bitmap is repeated. Gravity is ignored when the tile mode is enabled.
Constant Value Description
disabled -1 Do not tile the bitmap. This is the default value.
clamp 0 Replicates the edge color.
repeat 1 Repeats the bitmap in both direction.
mirror 2 Repeats the shader’s image horizontally and vertically, alternating mirror images so that adjacent images always seam.
创建重复的背景图片
在drawable目录下创建一个repeat_bg.xml:
<?xml version="1.0" encoding="utf-8"?><bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/bg" android:tileMode="repeat" />
然后在布局的xml文件中可以这样引用:
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/repeat_bg" ></LinearLayout>
- 鉴客 Android 背景图片重复 Background repeat
- Android 背景图片重复 Background repeat
- Android 背景图片重复平铺 Background repeat
- Android 背景图片重复平铺 Background repeat
- Android background背景图片平铺
- CSS中背景图片的属性:background-repeat、background-position、background-size
- background-repeat
- background-repeat:no-repeat
- HTML中background-repeat 重复背景图属性的的作用
- 如何防止网页的背景图片重复 no-repeat
- 背景图片background
- HTML&CSS——background: url() no-repeat 0 -64px;CSS中背景图片定位方法
- 解决android:background背景图片被拉伸问题
- 解决android:background背景图片被拉伸问题
- 解决android:background背景图片被拉伸问题
- 解决android:background背景图片被拉伸问题
- 解决android:background背景图片被拉伸问题
- android 背景图片的变形(background)
- iOS中使用RegexKitLite来试用正则表达式
- 1067_Color Me Less
- 参考:MyEclipse10+Flex4.6+BlazeDS终于可以跑程序了
- java实现hbase表创建、数据插入、删除表
- Spring 3.1MVC 实战
- 鉴客 Android 背景图片重复 Background repeat
- Reflector 已经out了,试试ILSpy
- Air Mobile As3 App
- 国际著名黑客大赛介绍与比较
- 1051_A New Growth Industry
- 破那个垃圾安全狗技术总汇
- ORA-00093: pga_aggregate_target must be between 10M and 4096G-1
- 1049_I Think I Need a Houseboat
- 卷积和积分运算