本文整理匯總了Java中android.graphics.drawable.BitmapDrawable.setTileModeXY方法的典型用法代碼示例。如果您正苦於以下問題:Java BitmapDrawable.setTileModeXY方法的具體用法?Java BitmapDrawable.setTileModeXY怎麽用?Java BitmapDrawable.setTileModeXY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.BitmapDrawable
的用法示例。
在下文中一共展示了BitmapDrawable.setTileModeXY方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fixRepeatableBitmapDrawable
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
/**
* Fix the repeatable background of a bitmap drawable.
* This only support a BitmapDrawable
* @param d the BitmapDrawable to set repeatable.
*/
public static void fixRepeatableBitmapDrawable(BitmapDrawable d) {
if(!needRepeatableFix()) {
return;
}
// I don't want to mutate because it's better to share the drawable fix for all that share this constant state
//d.mutate();
//Log.d(THIS_FILE, "Exisiting tile mode : " + d.getTileModeX() + ", "+ d.getTileModeY());
d.setTileModeXY(d.getTileModeX(), d.getTileModeY());
}
示例2: fixBackgroundRepeat
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
public static void fixBackgroundRepeat(View view) {
Drawable bg = view.getBackground();
if (bg != null) {
if (bg instanceof BitmapDrawable) {
BitmapDrawable bmp = (BitmapDrawable) bg;
bmp.mutate(); // make sure that we aren't sharing state anymore
bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
}
}
}