How to Customise Toast in Android?

前端 未结 6 522
礼貌的吻别
礼貌的吻别 2021-01-05 05:06

Is it possible to make Customize Toast in Android. like if can we place in it image icon and place button.

6条回答
  •  离开以前
    2021-01-05 05:23

    You can put any view in a Toast using setView. However, I'm not quite sure why you would want to place a button in it, as a Toast will rapidly disappear. Taken from the officiel developer site :

    When the view is shown to the user, appears as a floating view over the application. It will never receive focus. The user will probably be in the middle of typing something else. The idea is to be as unobtrusive as possible, while still showing the user the information you want them to see.

    So the toast should only be used to display information. For more complex interactions, you can use a Dialog.

提交回复
热议问题