Skip to content

Instantly share code, notes, and snippets.

@itoz itoz/gist:1050317
Created Jun 28, 2011

What would you like to do?
Android ライブ壁紙 Drawable 描画用 あれこれサンプル
// Android ライブ壁紙 Drawable 描画用 あれこれサンプル
* から Drawable取得
// 取得
private Drawable _image;
_image = r.getDrawable(R.drawable.image0);
int x =0;
int y =0;
int w = _image.getIntrinsicWidth();//Drawableの幅取得
int h= _image.getIntrinsicHeight();//Drawableの高さ取得
_image.setBounds(x, y, x + w, y + h);//★必ず呼ぶ
*カラーフィルター 例
ColorFilter cf = new PorterDuffColorFilter(Color.BLUE, PorterDuff.Mode.MULTIPLY);
_image.setColorFilter(Color.BLUE, PorterDuff.Mode.MULTIPLY);
* から動的にDrawableを取得
_image = _res.getDrawable(getResources().getIdentifier("ファイル名", "drawable", getPackageName()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.