带图片的Toast

Toast toast=Toast.makeText(MainActivity.this, "手机在振动", Toast.LENGTH_SHORT);
     View textView=toast.getView();

 LinearLayout ll=new LinearLayout(MainActivity.this);
    ImageView iv=new ImageView(MainActivity.this);
     ll.setOrientation(LinearLayout.HORIZONTAL);
     iv.setImageResource(R.drawable.ic_launcher);
     ll.addView(iv);
     ll.addView(textView);
     toast.setView(ll);
     toast.show();

原文地址:https://www.cnblogs.com/wdc224/p/3643771.html