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();
相关文章推荐
- android 休眠唤醒机制分析(三)
- Android中关于ContentProvider类的getType()方法的理解
- Android的启动模式(下)
- android 休眠唤醒机制分析(二)
- android 休眠唤醒机制分析(一)
- Android开发中Activity跳转动画以及finish动画
- 关于android客户端的导航栏(toolbar)
- Android菜单
- Android的启动模式(上)
- android学习——MeasureSpec介绍及使用
- Android虚拟机启用中文输入法及其它常用配置
- Android常用控件之GridView的蒙板用处和写法
- Android中AlertDialog的使用
- Android如何自定义Toast?and 四种AleterDialog的用法
- android之使用get和post方式向服务器提交请求
- Android常用控件之Toast与AlertDialog的常规用法和自定义用法
- Android Studio导入aidl
- VMware安装Android虚拟机及adb调试
- 在Android应用中添加背景音乐
- Android中Activity启动模式详解