您的位置:首页 > 移动开发 > Android开发

android 基本控件

2015-08-27 20:08 429 查看

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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: