「Andorid入門」Toastをカスタマイズするプログラム

コード下記:
private void startnews24Toast() {
LinearLayout llMain = new LinearLayout(getApplicationContext());
llMain.setOrientation(LinearLayout.VERTICAL);
llMain.setBackgroundColor(Color.BLACK);
llMain.setGravity(Gravity.CENTER);
ImageView ivIcon = new ImageView(getApplicationContext());
ivIcon.setImageResource(R.drawable.ic_launcher);
llMain.addView(ivIcon);
TextView tvMsg = new TextView(getApplicationContext());
tvMsg.setText(“hello word");
tvMsg.setTextSize(18);
llMain.addView(tvMsg);
Toast mToast = new Toast(getApplicationContext());
mToast.setView(llMain);
mToast.show();
}

Android

Posted by arkgame