Android 背景图片重复 Background repeat
来源:互联网 发布:网络流量限制软件 编辑:程序博客网 时间:2024/04/30 06:44
本文转载自:
http://www.haoni.org/2011/04/21/androidbeijingtupianzhongfubackgroundrepeat/
以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="fill_parent" android:layout_height="fill_parent" android:background="@drawable/repeat_bg"></LinearLayout>
本文转载自:
http://www.haoni.org/2011/04/21/androidbeijingtupianzhongfubackgroundrepeat/
- 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)
- 2410看门狗驱动程序
- SQL列转行
- 让wordpress首页和分类列表页只显示文章标题列表
- 琐碎~~~得经常整理收藏
- 在当前activity中启动自己另一个程序的activity
- Android 背景图片重复 Background repeat
- Oracle中 如何对一张表的数据同时修改跟插入
- OGNL表达式详解
- Android基础之Menu控件
- 使用tcc编译器
- java中的内部类
- C#访问远程主机资源的方法
- ASP.NET 分Sheet导出EXCEL 2003
- 经典笔试题目分析