当前位置:网站首页>Use the transparent [x] cross button image in the dialog
Use the transparent [x] cross button image in the dialog
2022-06-24 20:33:00 【Rannki】
java: // load xml Layout file View view = LayoutInflater.from(getContext()).inflate(R.layout.main_share_dialog_layout3, null ,false); // Parameters here 2, It has to be this 【R.style.AlertDialogStyle】, Otherwise, it's just 【X】 The picture is a transparent picture , Nor is it transparent , There will be a white background . Dialog dialog = new Dialog(getContext(), R.style.AlertDialogStyle); dialog.setContentView(view); Window window = dialog.getWindow(); // Here, set the left and right spacing to be 90, Otherwise, the whole width will be directly occupied . window.getDecorView().setPadding(90, 0, 90, 0); dialog.show();
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/bg_share_radius"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@mipmap/ic_skirt" />
<RelativeLayout
android:paddingTop="10dp"
android:background="#FF8913"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_receive"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:text=" Accumulated bonus amount of bonus pool :"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_prize"
android:layout_below="@+id/tv_receive"
android:background="#FF8913"
android:drawableStart="@mipmap/ic_share_money"
android:textSize="30sp"
android:paddingStart="60dp"
android:textStyle="bold"
android:textColor="#FFFFDE56"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="100984.00" />
<TextView
android:id="@+id/tv_distance"
android:layout_below="@+id/tv_prize"
android:background="#FF8913"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="30dp"
android:text=" Dividend time left :"
android:textColor="@color/white"
android:textSize="16sp" />
<LinearLayout
android:layout_below="@+id/tv_distance"
android:paddingTop="5dp"
android:background="#FF8913"
android:id="@+id/bottom_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="60dp"
android:gravity="center_vertical">
<TextView
android:padding="2dp"
android:background="@drawable/bg_share_time_radius"
android:id="@+id/tv_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="10"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_day_word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="4dp"
android:layout_toRightOf="@+id/tv_day"
android:text=" God "
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:padding="2dp"
android:background="@drawable/bg_share_time_radius"
android:id="@+id/tv_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center"
android:text="10"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text=":"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:id="@+id/iv_bg_1"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@+id/tv_hour"
android:background="@drawable/ic_time_one2"
android:visibility="gone" />
<TextView
android:padding="2dp"
android:background="@drawable/bg_share_time_radius"
android:id="@+id/tv_minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_toRightOf="@+id/iv_bg_1"
android:gravity="center"
android:text="10"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text=":"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:id="@+id/iv_bg_2"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@+id/tv_minute"
android:background="@drawable/ic_time_one2"
android:visibility="gone" />
<TextView
android:padding="2dp"
android:background="@drawable/bg_share_time_radius"
android:id="@+id/tv_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center"
android:text="10"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:scaleType="fitXY"
android:src="@mipmap/ic_task_center" />
<ImageView
android:alpha="0.2"
android:layout_width="130dp"
android:layout_height="125dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:src="@mipmap/ic_dd" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:orientation="horizontal"
android:background="#FFFFEE56"/>
<RelativeLayout
android:paddingBottom="15dp"
android:paddingTop="8dp"
android:background="#FF8913"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_integral"
android:textStyle="bold|italic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="30dp"
android:text=" Bonus points are always available "
android:textColor="#FFFFEE56"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_share_integral"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_integral"
android:paddingStart="30dp"
android:paddingTop="5dp"
android:text=" Share shopping points "
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:background="@drawable/share_money"
android:layout_marginEnd="20dp"
android:gravity="center"
android:layout_width="100dp"
android:layout_height="40dp"
android:text=" Share to make money "
android:textColor="@color/white"
android:textSize="16sp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<!-- The picture here is a transparent picture 【X】-->
<ImageView
android:layout_marginTop="10dp"
android:id="@+id/share_x_image"
android:layout_width="match_parent"
android:layout_height="50dp"
android:src="@mipmap/ic_share_back" />
</LinearLayout>
Finished drawings :

边栏推荐
- [cloud resident co creation] ModelBox draws your own painting across the air
- Ribbon源码分析之@LoadBalanced与LoadBalancerClient
- 使用gorm查询数据库时reflect: reflect.flag.mustBeAssignable using unaddressable value
- 对“宁王”边卖边买,高瓴资本“高抛低吸”已套现数十亿
- Cooking business experience of young people: bloggers are busy selling classes and bringing goods, and the organization earns millions a month
- Leetcode(146)——LRU 缓存
- "Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"
- Huawei cloud modelarts has ranked first in China's machine learning public cloud service market for the fourth time!
- Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!
- 思源笔记工具栏中的按钮名称变成了 undefined,有人遇到过吗?
猜你喜欢
随机推荐
苹果不差钱,但做内容“没底气”
Sequence stack version 1.0
Predicate
RF_DC系统时钟设置GEN1/GEN2
红象云腾完成与龙蜥操作系统兼容适配,产品运行稳定
Batch capitalization of MySQL table names
Open programmable infrastructure (OPI) project, redefining dpu/ipu
It is said that Tencent officially announced the establishment of "XR" department to bet on yuanuniverse; Former CEO of Google: the United States is about to lose the chip competition. We should let T
【CANN文档速递05期】一文让您了解什么是算子
First understand redis' data structure - string
"Super point" in "Meng Hua Lu", is the goose wronged?
C语言实现扫雷(简易版)
Internet of things? Come and see Arduino on the cloud
【CANN文档速递04期】揭秘昇腾CANN算子开发
VMware virtual machine setting static IP
传统的IO存在什么问题?为什么引入零拷贝的?
视频平台如何将旧数据库导入到新数据库?
得物多活架构设计之路由服务设计
maptalks:数据归一化处理与分层设色图层加载
[multi thread performance tuning] multi thread lock optimization (Part 1): optimization method of synchronized synchronization lock









