2017年10月29日日曜日

SupportActionBar 背景色変更

SupportActionBar 背景色変更


android.support.v7.app.ActionBar actionBar = getSupportActionBar();
int color = android.R.color.black;
Drawable backgroundDrawable = getApplicationContext().getResources().getDrawable(color);
actionBar.setBackgroundDrawable(backgroundDrawable);


2017年10月16日月曜日

assets フォルダ内の画像を読み込み

assets フォルダ内の画像を読み込み


AssetManager assetManager = getAssets();
ImageView imageView = (ImageView) findViewById(R.id.imageView);
InputStream inputStream = null;
try {
     inputStream = assetManager.open("g1213.png");
} catch (IOException e) {
     e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmap);