3.自定义带图片的Toast显示
实现代码如下:
Toast toast = Toast.makeText(getApplicationContext(), TOASTBTN_3,Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 50, -100);
LinearLayout layout = (LinearLayout) toast.getView();
ImageView image = new ImageView(getApplicationContext());
image.setImageResource(R.drawable.wallpaper_tree_small);
layout.addView(image, 0);
toast.show();
4.完全自定义的Toast显示
实现代码:
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.userdefinedtoast,
(ViewGroup) findViewById(R.id.toast_layout));
TextView txtView_Title = (TextView) view
.findViewById(R.id.txt_Title);