让背景小图不是拉伸而是多个重复(类似于将一张小图设置电脑桌面时的效果)
2011-10-11 00:17
387 查看
先上图:
backrepeat.xml
代码方式:
<xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/MainLayout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/backrepeat" >
backrepeat.xml
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/repeatimg" android:tileMode="repeat" android:dither="true" />
代码方式:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon); BitmapDrawable bd = new BitmapDrawable(bitmap); bd.setTileModeXY(TileMode.REPEAT , TileMode.REPEAT ); bd.setDither(true); view.setBackgroundDrawable(bd);
相关文章推荐
- Android之背景图片设置为重复而不是默认的拉伸
- 让背景小图不是拉伸而是多个重复
- Android之背景图片设置为重复而不是默认的拉伸
- 让背景小图不是拉伸而是多个重复
- 让背景小图不是拉伸而是多个重复
- 【开源程序(C++)】获取bing图片并自动设置为电脑桌面背景
- 网页中flash背景透明不是在做flash的时候设置的,而是在网页中插入flash的设置的,在插入的时候默认为不透明的!
- css3实现背景图片拉伸效果像桌面壁纸一样
- 怎么更改win7登录界面 梦幻桌面动态效果电脑桌面快速分屏设置虚拟wifi热点方法_桌面图标弹出提示飞雪桌面日历自定义桌面
- 在html中,怎么设置背景图片不重复不平铺,只显示一张图片
- 简单button样式的设置(不是直接将背景设置为图片,而是设置背景的颜色)
- 使用CSS拉伸背景图(不是重复绘制背景图)
- Python爬虫之提取Bing搜索的背景图片并设置为Windows的电脑桌面
- UIButton 设置背景图片 拉伸效果
- Win8系统如何设置桌面背景放映幻灯片效果
- css 如何让背景图片拉伸填充避免重复显示 不是平铺
- 在html中,怎么设置背景图片不重复不平铺,只显示一张图片
- C#获取当前电脑桌面的壁纸,并设置成窗体背景图
- 获取bing图片并自动设置为电脑桌面背景(使用 URLDownloadToFile API函数)
- Flex背景图像实现类似于html平铺拉伸