//创建Toast对象
Toast mToast = Toast.makeText(ShareYourLifeActivity.this, "内存卡不可用,请检查...", Toast.LENGTH_LONG);
//创建LinearLayout布局
LinearLayout toastView = (LinearLayout) mToast.getView();
//设置LinearLayout的布局取向
toastView.setOrientation(LinearLayout.HORIZONTAL);
//创建ImageView
ImageView imageCodeProject = new ImageView(getApplicationContext());
imageCodeProject.setImageResource(R.drawable.icon);
//给toastView添加View布局
toastView.addView(imageCodeProject, 0);
//显示Toast
mToast.show();
图示:
转载于:https://my.oschina.net/wal8023/blog/28612