LayoutInflater factory = LayoutInflater.from(BindEmail.this);
final View show = factory.inflate(R.layout.show_protocol, null);
Button confirm_btn = (Button) show.findViewById(R.id.confirm_btn);
final AlertDialog d = new AlertDialog.Builder(BindEmail.this).show();
d.setContentView(show);
confirm_btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
-----------------------
show_protocol.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="679px" android:layout_height="419px"
android:background="@drawable/alert_with_button">
<TextView android:id="@+id/title_tv" android:layout_width="match_parent"
android:layout_height="wrap_content" android:text="车网互联服务使用协议"
android:textSize="25dip" android:paddingTop="5dip"
android:paddingLeft="40dip" android:textColor="#ffffff" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/title_tv" android:id="@+id/body_sv"
android:paddingTop="5dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingBottom="10dip"
android:layout_above="@+id/confirm_btn"
android:scrollbars="vertical">
<TextView
android:text=" 此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容,此处显示服务协议具体内容"
android:textSize="20dip" android:layout_height="wrap_content"
android:layout_width="match_parent" android:textColor="#444444"></TextView>
</ScrollView>
<Button
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:textColor="#ffffff"
android:background="@drawable/submit_button_style" android:text="我同意"
android:layout_height="wrap_content" android:textSize="20dip"
android:layout_width="wrap_content"
android:id="@+id/confirm_btn" ></Button>
</RelativeLayout>
-------
分享到:
相关推荐
比较漂亮的自定义AlertDialog。
最近项目里有个功能点,需要使用...我需要继承AlertDialog,设置自己的内容view,重写onKeyDown方法,设置dialog的位置等...... 写了个demo. Demo是在5.0手机上测试的, 6.0以上系统还需要添加动态运行时权限的逻辑 。
erilyAlertDialog 是由Herily[虚拟名]研究android对话框源码后的结晶,继承自AlertDialog并根据需要重写了部分代码,使其能满足自己所需要的风格的对话框。你可以像使用AlertDialog一样的使用HerilyAlertDialog。你...
最近项目里有个功能点,需要使用定制seekbar调节媒体音量,不能使用【按物理音量上下键】弹出的系统dialog做...我需要继承AlertDialog,设置自己的内容view,重写onKeyDown方法,设置dialog的位置等...... 写了个demo
像列表这种选择项的弹出式对话框,要改变样式一般都采取重写layout方式 今天才了解到 其实可以自定义样式,与大家分享下,其实很简单 AlertDialog.Builder builder = new AlertDialog.Builder(new ...
免不了会用到各种各样的对话框,相信有过其他平台开发经验的朋友都会知道,大部分的平台都只提供了几个最简单的实现,如果我们想实现自己特定需求的对话框,大家可能首先会想到,通过继承等方式,重写我们自己的...
源码mcustom-HerilyAlertDialog-master,完全custom的Android Dialog[HerilyAlertDialog],1.HerilyAlertDialog 是由Herily[虚拟名]研究android对话框源码后的结晶,继承自AlertDialog并根据需要重写了部分代码,使...
这里的问题:当我点击确定按钮,也就是 AlertDialog 里的 PositiveButton 的时候,我们需要判断用户是输入是否符合我们的预期,如果不符合通常提示用户重写输入,且不关闭当前的对话框,但上图中点击按钮后会自动的...
HerilyAlertDialog是由Herily[虚拟名]研究android对话框源码后的结晶,继承自AlertDialog并根据需要重写了部分代码,使其能满足自己所需要的风格的对话框。你可以像使用AlertDialog一样的使用HerilyAlertDialog。你...
声明列表对话框的id,显示列表对话框,为按钮添加OnClickListener监听器,然后重写的onCreateDialog方法: switch(id){//对id进行判断 case LIST_DIALOG: Builder b = new AlertDialog.Builder(this);//创建...
OnClickListener() { public void onClick(View v) { AlertDialog dlg = new AlertDialog.Builder(ArtistsActivity.this) .setTitle("Login Exit").setMessage("您要退出程序??") .setPositiveButton("确定", new ...
protected Dialog onCreateDialog(int id) {//重写onCreateDialog方法 Dialog dialog = null;//声明一个Dialog对象用于返回 switch(id){//对id进行判断 case LIST_DIALOG_SINGLE: Builder b = new ...
//选项数组,通过重写onCreate方法,从XML文件读取下拉框内容到字符串数组中,为按钮添加监听器,并显示多选按钮对话框,同时自定义了一个处理程序,用于判断用户是否选择多选 框中的内容:Dialog dialog = null;...
1.继承自AlertDialog,重写onCreat /** * Created by ruancw on 2018/6/7. * 自定义的带圆角的对话框 */ public class RoundCornerDialog extends AlertDialog{ private TextView tvTitle; private T
写一个类,该类继承自Plugin并重写execute方法。 import org.json.JSONArray; import android.app.Activity; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android...
2.5.3 使用AlertDialog创建自定义 对话框 116 2.5.4 使用PopupWindow 121 2.5.5 使用DatePickerDialog、TimePickerDialog 123 2.5.6 使用ProgressDialog创建进度 对话框 125 2.6 消息提示 127 2.6.1...
2.5.3 使用AlertDialog创建自定义 对话框 116 2.5.4 使用PopupWindow 121 2.5.5 使用DatePickerDialog、TimePickerDialog 123 2.5.6 使用ProgressDialog创建进度 对话框 125 2.6 消息提示 127 2.6.1 使用Toast显示...
2.5.3 使用AlertDialog创建自定义 对话框 116 2.5.4 使用PopupWindow 121 2.5.5 使用DatePickerDialog、TimePickerDialog 123 2.5.6 使用ProgressDialog创建进度 对话框 125 2.6 消息提示 127 2.6.1 使用Toast显示...
3.12 具有交互功能的对话框——AlertDialog窗口 3.13 置换文字颜色的机关——Button与TextView的交互 3.14 控制不同的文字字体——Typeface对象使用 3.15 如iPhone拖动相片特效——Gallery画廊 3.16 自制计算器——...
3.12 具有交互功能的对话框——AlertDialog窗口 3.13 置换文字颜色的机关——Button与TextView的交互 3.14 控制不同的文字字体——Typeface对象使用 3.15 如iPhone拖动相片特效——Gallery画廊 3.16 自制计算器——...