public void show(Context context, String tvString){
View layout = LayoutInflater.from(context).inflate(R.layout.toast_common,null);
TextView text = (TextView) layout.findViewById(R.id.tv_message);
text.setText(tvString);
if(toast==null){
toast = new Toast(MyApplication.getContext());
}
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
}
网友评论