Custom Toast Cancel not working

前端 未结 4 1053
南笙
南笙 2021-02-09 20:52

I have seen a number of questions on cancelling toast. None of them is working.

I have a custom Toast. The code for that is all but one line same as http://developer.an

4条回答
  •  别跟我提以往
    2021-02-09 20:58

    Use this code for custom text:

    LayoutInflater mInflater=LayoutInflater.from(context);
    View view=mInflater.inflate(R.layout.tost_layout,null);
    Toast toast=new Toast(this);
    toast.setView(view);
    toast.show();
    

提交回复
热议问题