Android 消息,通知,广播,闹钟

 通过Toast类显示消息提示框

特点:

没有任何控制按钮

不会获得焦点

经过一段时间后会自动小数

Toast.makeText(this,"要显示的内容",Toast.LENGTH_SHORT).show()

setDuration(int duration)

用于设置消息提示框持续时间的长短,通常使用Toast。LENGTH_LONG

或者 Toast.LENGTH_SHORT参数

setGravity(int gravity,int xOffset,int yOffset) 指定具体偏移值
setMargin(float horizontalMargin,float VerticalMargin) 页边距
setText(CharSequence s) 文本内容
setView(View view) 显示视图

 使用

猜你喜欢

转载自blog.csdn.net/weixin_38107457/article/details/120875728