AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.content);//  加载布局  MainActivity.content  对应  MainActivity.thistime_view = View.inflate(MainActivity.content, R.layout.time_long, null);count_tiime = (TextView) time_view.findViewById(R.id.count_tiime);count_tiime.setText(hms);builder.setView(time_view);// 点击遮罩层不关闭 即弹窗的外部  builder.setCancelable(true); 对应点击外部可关闭builder.setCancelable(false);builder.create().show();

android AlertDialog 弹窗自定义布局 点击外部不关闭弹窗_第1张图片

android AlertDialog 弹窗自定义布局 点击外部不关闭弹窗_第2张图片

可自定义 time_long.xml 布局

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:padding="30dp">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="20dp"        android:orientation="horizontal">        <TextView            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_marginRight="30dp"            android:text="开始记录时间"            android:textColor="#33b5e5"            android:textStyle="bold">TextView>        <TextView            android:id="@+id/start_tiime"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:text="开始记录时间">TextView>    LinearLayout>    <TextView        android:id="@+id/count_tiime"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:text="开始时间">TextView>LinearLayout>

更多相关文章

  1. 自定义progressbar使用图片
  2. Shape实现圆形图片
  3. android 相对布局覆盖问题
  4. android 4.0.3 设置时间无法更新到RTC

随机推荐

  1. 让我们来看看安卓这十年到底有哪些变化
  2. Android(安卓)SystemProperties设置/取得
  3. Android(安卓)中使用代码动态网格布局
  4. Android(安卓)View 滑动基础知识
  5. 平安科技移动开发二队技术周报(第五期)
  6. Android鏃犱俊鍙峰拰涓婄綉闂宸茶В
  7. android 数据库之Cursor
  8. 【多媒体编解码】Openmax IL (二)Android多
  9. android下关联源码的最简单的方法
  10. android 绯荤粺閲嶅惎涓庡叧鏈猴細java