我有这个简单的代码,它带给我一个图像的祝酒词。是否可以获得常规吐司在此吐司上使用的背景?
提前谢谢
Toast ImageToast = new Toast(getBaseContext());
LinearLayout toastLayout = new LinearLayout(getBaseContext());
toastLayout.setOrientation(LinearLayout.HORIZONTAL);
ImageView image = new ImageView(getBaseContext());
TextView text = new TextView(getBaseContext());
image.setImageResource(R.drawable.smile);
text.setTextSize(30);
text.setText("Show this text");
toastLayout.addView(image);
toastLayout.addView(text);
ImageToast.setView(toastLayout);
ImageToast.setDuration(Toast.LENGTH_LONG);
ImageToast.show();