自己定义对话框中的信息body布局

                  LayoutInflater inflater =getLayoutInflater();
View layout = inflater.inflate(R.layout.alert_dialog_content, null);
AlertDialog musicDialog = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT).create();
musicDialog.setView(layout);
TextView textView = (TextView)layout.findViewById(R.id.message);
textView.setText(mDialogDesc);
musicDialog.setTitle(R.string.delete_item);
musicDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.delete_confirm_button_text), mButtonClicked);
musicDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getResources().getString(R.string.cancel), mButtonClicked);
musicDialog.setCanceledOnTouchOutside(true);
musicDialog.setCancelable(true);
musicDialog.setOnKeyListener(mSearchKeyListener);
musicDialog.setIcon(android.R.drawable.ic_dialog_alert);
return musicDialog;

布局文件:

    <?

xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
--> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dip"
android:layout_marginEnd="8dip"
android:orientation="vertical"> <LinearLayout android:id="@+id/contentPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dip"
android:paddingBottom="12dip"
android:orientation="vertical">
<ScrollView android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/message"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:paddingTop="8dip"
android:paddingBottom="8dip"/>
</ScrollView>
</LinearLayout>
</LinearLayout>

自己定义AlertDialog对话框布局的更多相关文章

  1. android 开发 实现一个自定义布局的AlertDialog对话框

    对话框有很多实现方法,最常见的是在一个点击事件中代码直接写出对话框.如下: package com.example.lenovo.mydemo2; import android.content.Dia ...

  2. 在有EditText控件的AlertDialog对话框中自动弹出输入法

    我们先回顾一下创建AlertDialog的一般步骤. 一 inflate AlertDialog的布局文件   例如,其中dlg就是我们的布局文件.    View layout = LayoutIn ...

  3. Android应用开发学习之AlertDialog对话框

    作者:刘昊昱 博客:http://blog.csdn.net/liuhaoyutz 本文中我们通过一个例子来看AlertDialog对话框的实现,其运行效果如下: 主布局文件main.xml内容如下: ...

  4. Android学习:AlertDialog对话框

    AlertDialog可以生成各种内容的对话框,它生成的对话框包含4个区域:图标区,标题区,内容区,按钮区 <?xml version="1.0" encoding=&quo ...

  5. 安卓 自定义AlertDialog对话框(加载提示框)

    AlertDialog有以下六种使用方法: 一.简单的AlertDialog(只显示一段简单的信息) 二.带按钮的AlertDialog(显示提示信息,让用户操作) 三.类似ListView的Aler ...

  6. [android] 手机卫士自定义对话框布局

    手机防盗页面部分 点击手机防盗,进行判断,如果没有设置密码,显示一个设置密码的对话框,如果已经设置密码了,弹出输入密码对话框 密码保存在SharedPreferences中,数据取出进行判断 自定义一 ...

  7. 【转】Android AlertDialog自定义布局

    原文网址:https://blog.csdn.net/u010694658/article/details/53022294 由于开发中经常使用弹框,然而系统自带的弹框太局限,也不太美观,经常不能满足 ...

  8. android入门 — AlertDialog对话框

    常见的对话框主要分为消息提示对话框.确认对话框.列表对话框.单选对话框.多选对话框和自定义对话框. 对话框可以阻碍当前的UI线程,常用于退出确认等方面. 在这里主要的步骤可以总结为: 1.创建Aler ...

  9. AlertDialog 对话框 5种

    MainActivity.class public class MainActivity extends AppCompatActivity implements View.OnClickListen ...

随机推荐

  1. ORACLE数据库导出导入数据

    准备工作: 1.登录管理员system 2.create directory dbdata as 'C:\oracle\tempData';--创建备份文件夹 3.grant read,write o ...

  2. sort排序命令常见用法

    sort -n 按数字排序 [root@test88 ~]# cat test.txt 19036 6111 24039 3660 20610 10937 32408 20744 8248 28255 ...

  3. IDE按住ctrl 打开单元 无效时 的方法

    一般打开单元无效时 是由于程序有错误,若程序没有错误 可以重新build一下 再试. 若实在不行 就右键---open at cursor

  4. DER编码简介

    概念:DER是BER的子集,它为每一个ASN.1类型定义一种唯一的编码方案. DER与BER的区别:DER在BER的基础上增加了如下限制:长度小于等于127,必须使用短型长度表示法.长度大于127,必 ...

  5. Vibrator震动

    今天又学一招: Android手机中的震动由Vibrator实现.设置震动事件,需要知道其震动的时间长短.震动的周期等. 在 Android Vibrator中,震动的时间以毫秒计算(1/1000秒) ...

  6. Webpack, VSCode 和 Babel 组件模块导入别名

    很多时候我们使用别人的库,都是通过 npm install,再简单的引入,就可以使用了.     1 2 import React from 'react' import { connect } fr ...

  7. 在内网环境使用WPAD/PAC和JS攻击win10

    转:https://mp.weixin.qq.com/s/qoEZE8lBbFZikKzRTwgdsw 在内网环境使用WPAD/PAC和JS攻击win10 2018-03-01 wangrin 看雪学 ...

  8. Linux通过FTP上传文件到服务器

    1.如果没有安装ftp,可执行: 输入:yum -y install ftp,回车 等待安装完毕 2.连接服务器 输入:ftp 服务器IP,回车 根据提示输入用户名和密码 3.上传下载操作 1). 上 ...

  9. android jni 内部 以及 安卓 init 分析

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha

  10. 安卓 onTouch OnTouchEvent onChick 顺序

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 分发触摸事件 -> 在 触摸 时候 -> 在触摸事件时候->在点击时候 ...