Toast是用來提示用戶的,實現更好的用戶體驗.
1、使用圖片
Toast toast = new Toast(this);
ImageView view = new ImageView(this);
view.setImageResource(R.drawable.icon);
toast.setView(view);
toast.show();
2、使用文字對話框
Toast toast = Toast.makeText(this, "只能輸入數字", Toast.LENGTH_SHORT);
toast.show();