带图片的Toast提示信息框

					Toast toast = new Toast(AppListActivity.this);
					toast.setGravity(Gravity.CENTER, 0, 0);

					LinearLayout ll = new LinearLayout(AppListActivity.this);
					LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT / 2, LayoutParams.MATCH_PARENT / 2);
					ll.setLayoutParams(lp);
					ll.setBackgroundResource(R.drawable.color_frame_halftrans_bg);
					ll.setGravity(Gravity.CENTER);

					ImageView image = new ImageView(AppListActivity.this);
					image.setImageResource(R.drawable.remind_icon);
					ll.addView(image);

					TextView text = new TextView(AppListActivity.this);
					text.setText(R.string.str_app_already_add);
					text.setTextSize(30);
					text.setTextColor(Color.WHITE);
					ll.addView(text);

					toast.setView(ll);
					toast.setDuration(Toast.LENGTH_SHORT);
					toast.show();

带图片的Toast提示信息框_第1张图片

你可能感兴趣的:(android,自定义Toast)