Android自定义弹出框dialog效果-创新互联

项目要用到弹出框,还要和苹果的样式一样(Android真是没地位),所以就自己定义了一个,不是很像(主要是没图),但是也还可以。

创新互联于2013年创立,公司以网站设计、网站建设、系统开发、网络推广、文化传媒、企业宣传、平面广告设计等为主要业务,适用行业近百种。服务企业客户超过千家,涉及国内多个省份客户。拥有多年网站建设开发经验。为企业提供专业的网站建设、创意设计、宣传推广等服务。 通过专业的设计、独特的风格,为不同客户提供各种风格的特色服务。

废话不多说了,直接上代码

1、先看布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:padding="20dp"
 android:orientation="vertical">

 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center_horizontal"
  android:background="@drawable/custom_dialog_background"
  android:orientation="vertical">

  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:gravity="center_horizontal"
   android:orientation="vertical">

   <TextView
    android:id="@+id/tv_title_custom_dialog"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:text="提醒"
    android:textColor="#000"
    android:textSize="18dp" />

   <TextView
    android:id="@+id/tv_message_custom_dialog"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:text="您确定要取消订单吗" />
  </LinearLayout>

  <View
   android:layout_width="match_parent"
   android:layout_height="0.5dp"
   android:layout_marginTop="20dp"
   android:background="#dfdfdf" />

  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="horizontal">

   <Button
    android:id="@+id/btn_negative_custom_dialog"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/transparent"
    android:text="取消"
    android:textColor="@android:color/holo_blue_dark" />

   <View
    android:layout_width="0.5dp"
    android:layout_height="match_parent"
    android:background="#dfdfdf" />

   <Button
    android:id="@+id/btn_positive_custom_dialog"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/transparent"
    android:text="确定"
    android:textColor="@android:color/holo_blue_dark" />
  </LinearLayout>
 </LinearLayout>
</LinearLayout>

当前题目:Android自定义弹出框dialog效果-创新互联
网站URL:https://www.cdcxhl.com/article10/dpcpgo.html

成都网站建设公司_创新互联,为您提供ChatGPTApp设计企业建站网站策划手机网站建设标签优化

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站建设网站维护公司