这是我的样子已经显示吐司
500毫秒。虽然,它显示超过一秒。
This is the way I have to show the Toast
for 500 milliseconds. Though, it's showing more than a second.
Toast.makeText(LiveChat.this, "Typing", 500).show();
我如何能显示吐司
仅为500毫秒?
这不能做。要显示举杯的长度比 Toast.LENGTH_SHORT
短,你必须你想要的时间后取消。是这样的:
This cannot be done. To show a toast for a length shorter than Toast.LENGTH_SHORT
, you must cancel it after the time you want. Something like:
final Toast toast = Toast.makeText(getApplicationContext(), "This message will disappear in half second", Toast.LENGTH_SHORT);
toast.show();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
toast.cancel();
}
}, 500);
上一篇:减小位图的大小在Android中一些特定的像素位图、像素、大小、Android
下一篇:安卓:WRAP_CONTENT不工作与ListView控件控件、工作、WRAP_CONTENT、ListView