android布局的两个属性dither和tileMode
来源:互联网 发布:著名软件培训学校 编辑:程序博客网 时间:2024/05/17 09:15
1.tileMode(平铺)属性:
它的效果为让背景用同一张图重复使用铺满整个画布,而不是一张图拉伸后铺满整个画布。它有三个属性值:
repeat:重复使用;
mirror:和repeat相似,不同的是每两行图以镜面倒映的方式显示
clamp: 保持原图不变
repeat效果:
mirror效果:
页面布局如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/ic_launcher"> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/repeat"> </LinearLayout></LinearLayout>
<?xml version="1.0" encoding="utf-8"?><bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ic_launcher" android:dither="true" android:tileMode="repeat" > </bitmap>
public static void setBackGroupdRepeat(View view,Context context,int iconId){Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), iconId);BitmapDrawable bd = new BitmapDrawable(bitmap);bd.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);bd.setDither(true);view.setBackground(bd);}
2:dither(抖动)属性
Dither(图像的抖动处理,当每个颜色值以低于8位表示时,对应图像做抖动处理可以实现在可显示颜色总数比较低(比如256色)时还保持较好的显示效果。
它不仅在xml属性中使用,Paint类中也有此属性:paint.setDither(true);
0 0
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode
- 关于android布局的两个属性dither和tileMode,background 平铺
- android:scaleType属性和背景平铺方式 tileMode
- Android Drawable Resources系列1:Bitmap(dither图像抖动、tileMode平铺模式)
- 图像处理的Dither和Banding
- 图像处理的Dither和Banding
- 图像处理的Dither和Banding
- 图像处理的Dither和Banding
- 动态数据报表
- Android下使用Crashlytics
- 快消品企业营销费用管理的困惑
- dedecms5.7 不能自动提取缩略图 解决方案
- GCC常用的操作选项
- android布局的两个属性dither和tileMode
- __weak __typeof(self)weakSelf = self和__strong __typeof(weakSelf)strongSelf = weakSelf
- Error format not a string literal and no format arguments解决方案
- storm学习2-storm生命周以及相关配置详解
- quartus调用modelsim仿真锁相环
- ListView基础例子
- 关于友元函数的总结
- ERROR: Removing 'hello': Device or resource busy
- 第十六周 OJ平台-有相同数字?