码迷,mamicode.com
首页 > 其他好文 > 详细

自定义Toast

时间:2015-02-27 13:31:10      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

public class TopToastView {
    /** 
     * 初始化Toast提示,并show
     * */
    public static void initToast(Context context,String top_hint,int img_res){
        Toast topToast = Toast.makeText(context, top_hint, Toast.LENGTH_LONG);
        topToast.setGravity(Gravity.CENTER|Gravity.TOP, 0, 0);
        LinearLayout ll_bg = (LinearLayout) topToast.getView();
        ImageView img_bg = new ImageView(context);
        img_bg.setImageResource(img_res);
        ll_bg.addView(img_bg , 0);
        topToast.show();
    }
}

 

自定义Toast

标签:

原文地址:http://www.cnblogs.com/rh1910362960/p/4303046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!