android自定义的toast样式
来源:互联网 发布:mac mini nas 方案 编辑:程序博客网 时间:2024/05/23 11:48
自定义 Toast 想要什么样式就可以写什么样式
activity
View toastView = getLayoutInflater().inflate(R.layout.toast_bg, null);
Toast toast=new Toast(getApplicationContext());
toast.setView(toastView);
TextView tv=(TextView)toastView.findViewById(R.id.tv_toast);
tv.setText("您尚未登录,请先登录");
toast.show();
toast_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/toast_bg" >
<TextView
android:id="@+id/tv_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="#000000" >
</TextView>
</LinearLayout>
toast_bg.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#ffffff" />
<stroke
android:width="1dp"
android:color="#FFFFFF" />
<padding
android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="6dp" />
<corners android:radius="3dp" />
</shape>
- android自定义的toast样式
- Android自定义Toast样式
- android Toast 自定义样式
- Android自定义Toast样式
- 自定义Android Toast样式
- Android自定义Toast样式
- Android中Toast的自定义的样式
- 一只大二狗的Android历程--自定义Toast样式
- Android wiki:14.自定义Toast样式
- Android之自定义Toast提示框样式
- Android例子—自定义Toast(吐司)样式
- 【Android开发点滴】自定义Toast样式
- Android:自定义的Toast
- Android 自定义Toast,修改Toast样式和显示时长
- Android 自定义Toast,修改Toast样式和显示时长
- Android Toast的多种样式
- Android自定义吐司Toast:自定义样式、自定义显示时长
- Android自定义Toast取代系统的Toast
- openSession和getCurrentSession之间的区别
- 读《C专家编程》笔记-第三章 分析C语言的声明
- #ifndef/#define/#endif使用和交叉引用问题详解
- Win7怎样添加环境变量
- XCode快捷键
- android自定义的toast样式
- HDOJ 题目4000 Fruit Ninja(树状数组)
- 斐波那契数列的算法实现 —— python
- C语言strcat()
- 黑马程序员-OC回顾-语法总结
- nodejs安装express时丢人了
- C++顺序容器vector,deque,list
- 惯性力的数学推导
- [oracle]数据库备份还原操作详细操作