自定义Toast
来源:互联网 发布:神龙契约披风数据 编辑:程序博客网 时间:2024/06/05 20:52
1.在xml文件中定义一个布局
如:
<?xml version="1.0" encoding="utf-8"?><TextView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_centerInParent="true"android:id="@+id/toast_by_text"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="18sp"android:textColor="#ffffffff"android:paddingTop="2dp"android:paddingBottom="2dp"android:gravity="center"android:layout_marginTop="3dp"android:layout_marginBottom="3dp"android:layout_centerHorizontal="true"android:text="请稍后" />
2.示例Java代码
LayoutInflater inflater = activity.getLayoutInflater();View layout = inflater.inflate(R.layout.test_toast, null);TextView textView = (TextView) layout.findViewById(R.id.toast_by_text);textView.setText("请稍后"); Toast toast = new Toast(activity);toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);toast.setDuration(Toast.LENGTH_SHORT);toast.setView(layout);toast.show();
0 0
- 自定义Toast
- 自定义Toast
- 自定义Toast
- 自定义Toast
- 自定义toast
- 自定义toast
- 自定义Toast
- 自定义toast
- 自定义Toast
- 自定义Toast
- 自定义Toast
- Toast自定义
- 自定义Toast
- 自定义Toast
- 自定义Toast
- 自定义Toast
- 自定义toast
- 自定义Toast
- #include<stm32f10x_lib.h>和#include<stm32f10x.h>有什么不同
- 在python中处理HDF5文件中的link
- op自举 正反馈
- UIImageView和UIImage,CGContextRef
- 编译器条件编译宏
- 自定义Toast
- 无序数组的二分查找
- 安卓 利用Fragment添加自定义标题栏
- Nginx常用Rewrite伪静态规则:
- maven3.0使用
- mongo gui client
- SQL 分组函数 group by
- 123
- nginx上万能的wordpress伪静态配置方案