自己定义对话框中的信息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. discuz伪静态设置

        Discuz! 通用伪静态 -包含所有类型主机本人找了一下午才找到的,谢谢这位原创者,发出来让大家用. 第一步:打开后台  全局 SEO设置 全部打勾<ignore_js_op>  ...

  2. PlantUML——3.Graphviz的安装

    官网:http://www.graphviz.org/Home.php   由于plantuml使用Graphviz来生成相关图形(只有序列图可以不依赖它),其它图形都需要, 因此得安装它,否则生成图 ...

  3. mktime(将时间结构数据转换成经过的秒数)

    mktime(将时间结构数据转换成经过的秒数)表头文件#include<time.h>定义函数time_t mktime(strcut tm * timeptr);函数说明mktime() ...

  4. 一张图总结html5新特性

  5. Jmeter中的逻辑控制器(四)

    Jmeter中的逻辑控制器 (Logic Controller) [线程组]右键—>[添加]—>[逻辑控制器] 简单控制器(Simple Controller ) 没有特殊功能,目的是形成 ...

  6. AC日记——#2057. 「TJOI / HEOI2016」游戏 LOJ

    #2057. 「TJOI / HEOI2016」游戏 思路: 最大流: 代码: #include <cstdio> #include <cstring> #include &l ...

  7. [实战]MVC5+EF6+MySql企业网盘实战(14)——思考

    写在前面 从上面更新编辑文件夹,就一直在思考一个问题,之前编辑文件夹名称,只是逻辑上的修改,但是保存的物理文件或者文件夹名称并没有进行修改,这样就导致一个问题,就是在文件或者文件夹修改名称后就会找不到 ...

  8. Js数组的常用的方法概述

    学习JS的同学们,也曾对数组进行学习掌握,所以我也把数组中常用的方法列举下来,相互学习 不多废话,直接上正文 .                 快乐的分割线... 一.对象继承的方法 数组是一种特殊 ...

  9. PHP 中文乱码解决方式

    1.PHP代码在PHP Storm中乱码,设置PHP Storm的默认文件编码格式为UTF-8: 文件->设置->编辑器->文件编码->将所有默认编码调整为UTF-8: 2.对 ...

  10. NoSql数据库 设计上面的一些心得

    NoSql数据库这个概念听闻许久了,也陆续看到很多公司和产品都在使用,优缺点似乎都被分析的清清楚楚.但我心里一直存有一个疑惑,它的出现究竟是为了解决什么问题? 用户信息表,书籍信息表,用户为书籍打分信 ...