采用
JavaScript实现Android 应用中Toast对话框的效果
效果图:
使用说明
<script type="text/javascript" src="js/XToast.js"></script>
<script>
// init view,not essential
XToast.initView();
// use toast show info
XToast.showXToast();
// dismiss toast
XToast.dismissXToast();
</script>initView() 初始化视图
param:
initView(option);
opation:Object
| 参数 | 说明 |
|---|---|
| opation:Object | 参数详解: width:宽度 height:高度 fontSize:字体大小 color:字体颜色 unit:单位:px/em/rem bottom:距离下方的位置 borderRadius:设置边框圆角 |
initView(y);
| 参数 | 说明 |
|---|---|
| y:number or string | 改变在Y方向上的位置 |
| string:top/center/bottom | top:显示在最上方,center:显示在中间位置,bottom:显示在下方 |
initView(y,color):
| 参数 | 说明 |
|---|---|
| y:number or string | 改变在Y方向上的位置 |
| color:string | 修改字体颜色,必须传入颜色值 |
initView(bWidth, bHeight, textSize, textColor,unit,bottom);
| 参数 | 说明 |
|---|---|
| bWidth:number | 设置宽度 |
| bHeight:number | 设置高度 |
| textSize:number | 设置字体大小 |
| textColor:string | 设置字体颜色 |
| unit:string | 设置单位(px/em/rem...) |
| bottom:number | 设置距离窗口下部分的距离 |
| borderRadius:number | 设置边框圆角 |
showXToast() 在界面显示XToast提示
param:
showXToast(info, duration);
| 参数 | 说明 |
|---|---|
| info:string | 显示信息 |
| duration:number | 显示时长 |
dismissXToast() 隐藏XToast提示
param:
dismissXToast();

