首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

让背景小图不是拉伸而是多个反复

2012-07-04 
让背景小图不是拉伸而是多个重复?先上图:?xml version1.0 encodingutf-8?LinearLayoutandroid:id

让背景小图不是拉伸而是多个重复

?先上图:


让背景小图不是拉伸而是多个反复
?

<xml version="1.0" encoding="utf-8"?><LinearLayoutandroid: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); ?
1 楼 helloandroid 2011-10-09   能有个效果图就更明了了

热点排行