50、Toast自定义布局
2024-10-21 06:12:25
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/black" />
<corners android:radius="10dp" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_my_dialog_cahce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="30dp"
android:paddingBottom="20dp"
android:paddingLeft="70dp"
android:paddingRight="70dp"
android:background="@drawable/my_dialog_cache_bg"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:src="@drawable/my_center_dialog_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="清除成功"
android:textColor="@color/white2"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Toast toast = new Toast(mActivity);
View view = LayoutInflater.from(mActivity).inflate(R.layout.my_center_cache_dialog, null); LinearLayout layout_my_dialog_cahce = (LinearLayout) view.findViewById(R.id.layout_my_dialog_cahce);
layout_my_dialog_cahce.getBackground().setAlpha(95); toast.setView(view);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
最新文章
- JAVA课程体系
- MySQL与MongoDB的操作对比,以及区别
- 34-nl 简明笔记
- 【译】用Fragment创建动态的界面布局(附Android示例代码)
- .net和java和谐相处之安卓客户端+.net asp.net mvc webapi 2
- DOM LOAD测试笔记
- fragment相关
- GoAccess日志分析工具使用文档
- php部分---面向对象静态、抽象类、oop接口、加载类、魔术方法、关键字。
- linux测试题
- Android中使用shape实现EditText圆角
- 会声会影X6-高级运动等效果的练习实践-与您分享...
- git创建与合并分支
- CentOS 7设置yum仅仅下载rpm不安装总结
- C#解析JSON字符串总结(转载)
- 【BZOJ4832】抵制克苏恩(矩阵快速幂,动态规划)
- vue安装搭建
- python函数查询、数学和比较操作符、二元操作符
- bzoj4237: 稻草人 cdq分治 单调栈
- 利用Git进行团队协作