Toast
android 信息提示弹窗,不能操作
- 自定义的Toast
属性
setText(“”);
设置显示的文本
setgravity(“center”,0,0);
设置信息显示的位置
setDuration();
自定义的Toast
Toast toast1=new Toast(getApplicationContext());
LayoutInflater inflater=getLayoutInflater();
View toastView=inflater.inflate(R.layout.item_toast,null);
TextView textView= (TextView) toastView.findViewById(R.id.text_toast);
textView.setText("我是内容");
toast1.setView(toastView);
toast1.setDuration(Toast.LENGTH_SHORT);
toast1.show();
Toast toast1=new Toast(getApplicationContext());
LayoutInflater inflater=getLayoutInflater();
View toastView=inflater.inflate(R.layout.item_toast,null);
TextView textView= (TextView) toastView.findViewById(R.id.text_toast);
textView.setText("我是内容");
toast1.setView(toastView);
toast1.setDuration(Toast.LENGTH_SHORT);
toast1.show();