时有可能使自定义吐司的Android系统。一样,如果我们可以在上面放置图像图标和地点按钮。
Is it possible to make Customize Toast in Android. like if can we place in it image icon and place button.
您也可以使用常规makeText()和处理的 getView()设置,看到未来下一个图像。
You can also use the regular makeText() and handle the getView() to set an image next to see the next.
Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
TextView tv = (TextView) toast.getView().findViewById(android.R.id.message);
if (null!=tv) {
tv.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
tv.setCompoundDrawablePadding(context.getResources().getDimensionPixelSize(R.dimen.padding_toast));