随想日语晶典,玉蒲团之淫行天下,辽西人才在线
android toast提示封装
android中经常用到toast提示,项目中很多toast提示,写很长的一行,简单的封装一下,将toast方法提出来,很方便使用:
实例代码:
/** * 提示字符串 * short toast * @param context * @param text * by hankkin at:2015-10-07 21:14:43 */ public static void showtoast(context context, string text) { toast toast = toast.maketext(context,text,toast.length_short); toast.setgravity(gravity.center,0,0); toast.show(); } /** * 提示字符串 * short toast * @param context * @param text * by hankkin at:2015-10-07 21:14:43 */ public static void showltoast(context context, string text) { toast toast = toast.maketext(context, text, toast.length_long); toast.setgravity(gravity.center, 0, 0); toast.show(); } /** * 提示根据resid关联字符串 * short toast * @param context * @param resid * by hankkin at:2015-10-07 21:14:43 */ public static void showtoast(context context, int resid) { toast toast = toast.maketext(context, resid, toast.length_short); toast.setgravity(gravity.center, 0, 0); toast.show(); } /** * 提示根据resid关联字符串 * 时常long toast * @param context * @param resid * by hankkin at:2015-10-07 21:14:43 */ public static void showltoast(context context, int resid) { toast toast = toast.maketext(context, resid, toast.length_long);; toast.setgravity(gravity.center, 0, 0); toast.
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android studio开发小型对话机器人app(实例代码)
Android通过Java sdk的方式接入OpenCv的方法
Android 通过cmake的方式接入opencv的方法步骤
Android Studio finish()方法的使用与解决app点击“返回”(直接退出)
Android 进度条 ProgressBar的实现代码(隐藏、出现、加载进度)
网友评论