android 弹出输入框有哪些弹出框的类

193932人阅读
Android(15)
做项目时,感觉android自带的弹出框样式比较丑,很多应用都是自己做的弹出框,这里也试着自己做了一个。
废话不说先上图片:
1.先自定义一个弹出框的样式
2.自己实现CustomDialog类,继承自Dialog,实现里面方法,在里面加载自定义样式的弹出框;
3.使用时,与使用Dialog一样
dialog_normal_layout.xml样式文件
&?xml version=&1.0& encoding=&utf-8&?&
&FrameLayout xmlns:android=&/apk/res/android&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:clickable=&true&
android:orientation=&vertical&
android:padding=&20.0dip& &
&LinearLayout
android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:layout_gravity=&center&
android:background=&@drawable/bg_bombbox&
android:orientation=&vertical& &
android:id=&@+id/title&
style=&@style/text_18_ffffff&
android:layout_width=&fill_parent&
android:layout_height=&40.0dip&
android:gravity=&center&
android:text=&@string/title_alert&
android:visibility=&visible& /&
&LinearLayout
            android:id=&@+id/content&
            android:layout_width=&fill_parent&
            android:layout_height=&wrap_content&
            android:gravity=&center& &
            &TextView
                android:id=&@+id/message&
                style=&@style/text_16_666666&
                android:layout_width=&fill_parent&
                android:layout_height=&wrap_content&
                android:gravity=&left|center&
                android:lineSpacingMultiplier=&1.5&
                android:minHeight=&120.0dip&
                android:paddingBottom=&15.0dip&
                android:paddingLeft=&20.0dip&
                android:paddingRight=&20.0dip&
                android:paddingTop=&15.0dip& /&
        &/LinearLayout&
android:layout_width=&fill_parent&
android:layout_height=&1.0px&
android:background=&#ffd0d0d0& /&
&LinearLayout
android:layout_width=&fill_parent&
android:layout_height=&60.0dip&
android:layout_gravity=&bottom&
android:background=&@drawable/dialog_bottom_bg&
android:gravity=&center&
android:orientation=&horizontal& &
android:id=&@+id/positiveButton&
style=&@style/text_15_ffffff_sdw&
android:layout_width=&114.0dip&
android:layout_height=&40.0dip&
android:background=&@drawable/btn_ok_selector&
android:gravity=&center&
android:text=&@string/ok& /&
android:id=&@+id/negativeButton&
style=&@style/text_15_666666_sdw&
android:layout_width=&114.0dip&
android:layout_height=&40.0dip&
android:layout_marginLeft=&20.0dip&
android:background=&@drawable/btn_cancel_selector&
android:gravity=&center&
android:text=&@string/cancel& /&
&/LinearLayout&
&/LinearLayout&
&/FrameLayout&
其中引用的样式文件styles.xml
&?xml version=&1.0& encoding=&utf-8&?&
&resources xmlns:android=&/apk/res/android&&
&style name=&AppBaseTheme& parent=&android:Theme.Light&&&/style&
&style name=&AppTheme& parent=&AppBaseTheme&&&/style&
&style name=&text_18_ffffff&&
&item name=&android:textSize&&18.0dip&/item&
&item name=&android:textColor&&#ffffffff&/item&
&style name=&text_16_666666&&
&item name=&android:textSize&&16.0dip&/item&
&item name=&android:textColor&&#ff666666&/item&
&style name=&sdw_white&&
&item name=&android:shadowColor&&#7fffffff&/item&
&item name=&android:shadowDx&&0.0&/item&
&item name=&android:shadowDy&&0.65&/item&
&item name=&android:shadowRadius&&1.0&/item&
&style name=&sdw_79351b&&
&item name=&android:shadowColor&&#ff79351b&/item&
&item name=&android:shadowDx&&0.0&/item&
&item name=&android:shadowDy&&1.0&/item&
&item name=&android:shadowRadius&&1.0&/item&
&style name=&text_15_ffffff_sdw& parent=&@style/sdw_79351b&&
&item name=&android:textSize&&15.0dip&/item&
&item name=&android:textColor&&#ffffffff&/item&
&style name=&text_15_666666_sdw& parent=&@style/sdw_white&&
&item name=&android:textSize&&15.0dip&/item&
&item name=&android:textColor&&#ff666666&/item&
&style name=&Dialog& parent=&android:style/Theme.Dialog&&
&item name=&android:background&&#&/item&
&item name=&android:windowBackground&&@android:color/transparent&/item&
&item name=&android:windowNoTitle&&true&/item&
&item name=&android:windowIsFloating&&true&/item&
&/resources&
自定义Dialog的实现类CustomDialog
package com.dyr.
import android.app.D
import android.content.C
import android.content.DialogI
import android.view.LayoutI
import android.view.V
import android.view.ViewGroup.LayoutP
import android.widget.B
import android.widget.LinearL
import android.widget.TextV
import com.dyr.view.R;
public class CustomDialog extends Dialog {
public CustomDialog(Context context) {
super(context);
public CustomDialog(Context context, int theme) {
super(context, theme);
public static class Builder {
private String positiveButtonT
private String negativeButtonT
private View contentV
private DialogInterface.OnClickListener positiveButtonClickL
private DialogInterface.OnClickListener negativeButtonClickL
public Builder(Context context) {
this.context =
public Builder setMessage(String message) {
this.message =
* Set the Dialog message from resource
* @param title
public Builder setMessage(int message) {
this.message = (String) context.getText(message);
* Set the Dialog title from resource
* @param title
public Builder setTitle(int title) {
this.title = (String) context.getText(title);
* Set the Dialog title from String
* @param title
public Builder setTitle(String title) {
this.title =
public Builder setContentView(View v) {
this.contentView =
* Set the positive button resource and it's listener
* @param positiveButtonText
public Builder setPositiveButton(int positiveButtonText,
DialogInterface.OnClickListener listener) {
this.positiveButtonText = (String) context
.getText(positiveButtonText);
this.positiveButtonClickListener =
public Builder setPositiveButton(String positiveButtonText,
DialogInterface.OnClickListener listener) {
this.positiveButtonText = positiveButtonT
this.positiveButtonClickListener =
public Builder setNegativeButton(int negativeButtonText,
DialogInterface.OnClickListener listener) {
this.negativeButtonText = (String) context
.getText(negativeButtonText);
this.negativeButtonClickListener =
public Builder setNegativeButton(String negativeButtonText,
DialogInterface.OnClickListener listener) {
this.negativeButtonText = negativeButtonT
this.negativeButtonClickListener =
public CustomDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// instantiate the dialog with the custom Theme
final CustomDialog dialog = new CustomDialog(context,R.style.Dialog);
View layout = inflater.inflate(R.layout.dialog_normal_layout, null);
dialog.addContentView(layout, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
// set the dialog title
((TextView) layout.findViewById(R.id.title)).setText(title);
// set the confirm button
if (positiveButtonText != null) {
((Button) layout.findViewById(R.id.positiveButton))
.setText(positiveButtonText);
if (positiveButtonClickListener != null) {
((Button) layout.findViewById(R.id.positiveButton))
.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
positiveButtonClickListener.onClick(dialog,
DialogInterface.BUTTON_POSITIVE);
// if no confirm button just set the visibility to GONE
layout.findViewById(R.id.positiveButton).setVisibility(
View.GONE);
// set the cancel button
if (negativeButtonText != null) {
((Button) layout.findViewById(R.id.negativeButton))
.setText(negativeButtonText);
if (negativeButtonClickListener != null) {
((Button) layout.findViewById(R.id.negativeButton))
.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
negativeButtonClickListener.onClick(dialog,
DialogInterface.BUTTON_NEGATIVE);
// if no confirm button just set the visibility to GONE
layout.findViewById(R.id.negativeButton).setVisibility(
View.GONE);
// set the content message
if (message != null) {
((TextView) layout.findViewById(R.id.message)).setText(message);
} else if (contentView != null) {
// if no message set
// add the contentView to the dialog body
((LinearLayout) layout.findViewById(R.id.content))
.removeAllViews();
((LinearLayout) layout.findViewById(R.id.content))
.addView(contentView, new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
dialog.setContentView(layout);
CustomDialog.Builder builder = new CustomDialog.Builder(this);
builder.setMessage(&这个就是自定义的提示框&);
builder.setTitle(&提示&);
builder.setPositiveButton(&确定&, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
//设置你的操作事项
builder.setNegativeButton(&取消&,
new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
builder.create().show();
至此,自定义弹出框已经完成,是不是感觉很简单呢。
这里附上一个自定义弹出框的小项目代码下载地址:
注:转载请注明出处&
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:339961次
积分:1911
积分:1911
排名:千里之外
原创:36篇
评论:57条
(11)(3)(1)(3)(4)(4)(11)(3)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'1640人阅读
Android功能(12)
这是一个基于AlertDialog和Dialog这两个类封装的多种弹出框样式,其中提供各种简单样式的弹出框使用说明。同时也可自定义弹出框。
项目地址:
1.使用链式开发代码简洁明了
2.所有的弹出框样式都在DialogUIUtils这个类中完成,方便查阅方法
3.可以自定义弹出框字体样式
4.简单的类似加载框的样式可以支持两种主题更改默认白色和灰色
Download or grab via Maven:
&dependency&
&groupId&com.dou361.dialogui&/groupId&
&artifactId&jjdxm-dialogui&/artifactId&
&version&x.x.x&/version&
&/dependency&
or Gradle:
compile 'com.dou361.dialogui:jjdxm-dialogui:x.x.x'
历史版本:
compile 'com.dou361.dialogui:jjdxm-dialogui:1.0.1'
compile 'com.dou361.dialogui:jjdxm-dialogui:1.0.0'
jjdxm-dialogui requires at minimum Java 9 or Android 2.3.
根据你的混淆器配置和使用,您可能需要在你的proguard文件内配置以下内容:
-keep class com.dou361.** {
如果需要使用toast类,采用单例模式的,多次调用toast后只会显示一个,需要初始化DialogUIUtils类,否则会抛异常,使用前初始化即可,代码如下
DialogUIUtils.init(appContext);
如果不需要使用toast类,可以不操作step1,直接使用相对于的弹出框即可。以下分别是部分弹出框的调用代码案例。
自定义弹出框
* 自定义弹出框 默认居中可取消可点击
* @param context
* @param contentView 自定义view
public static BuildBean showCustomAlert(Context context, View contentView)
* 自定义弹出框 默认可取消可点击
* @param context
* @param contentView 自定义view
* @param gravity
显示window的位置例如Gravity.center
public static BuildBean showCustomAlert(Context context, View contentView, int gravity)
* 自定义弹出框
* @param context
* @param contentView
自定义view
* @param gravity
显示window的位置例如Gravity.center
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
public static BuildBean showCustomAlert(Context context, View contentView, int gravity, boolean cancleable, boolean outsideTouchable)
View rootView = View.inflate(activity, R.layout.custom_dialog_layout, null);
DialogUIUtils.showCustomAlert(this, rootView).show();
* 弹出toast 默认白色背景可取消可点击
* @param context 上下文
* @param msg
public static BuildBean showToastTie(Context context, CharSequence msg)
* 弹出toast 默认可取消可点击
* @param context
* @param msg
* @param isWhiteBg true为白色背景false为灰色背景
public static BuildBean showToastTie(Context context, CharSequence msg, boolean isWhiteBg)
* 弹出toast
* @param context
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg
true为白色背景false为灰色背景
public static BuildBean showToastTie(Context context, CharSequence msg, boolean cancleable, boolean outsideTouchable, boolean isWhiteBg)
DialogUIUtils.showToastTie(this, "加载中...").show();
横向加载框
* 横向加载框 默认白色背景可取消可点击
* @param context 上下文
* @param msg
public static BuildBean showLoadingHorizontal(Context context, CharSequence msg)
* 横向加载框 默认可取消可点击
* @param context
* @param msg
* @param isWhiteBg true为白色背景false为灰色背景
public static BuildBean showLoadingHorizontal(Context context, CharSequence msg, boolean isWhiteBg)
* 横向加载框
* @param context
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg
true为白色背景false为灰色背景
public static BuildBean showLoadingHorizontal(Context context, CharSequence msg, boolean cancleable, boolean outsideTouchable, boolean isWhiteBg)
DialogUIUtils.showLoadingHorizontal(this, "加载中...").show();
md风格横向加载框
* md风格横向加载框 默认白色背景可取消可点击
* @param context 上下文
* @param msg
public static BuildBean showMdLoadingHorizontal(Context context, CharSequence msg)
* md风格横向加载框 默认可取消可点击
* @param context
* @param msg
* @param isWhiteBg true为白色背景false为灰色背景
public static BuildBean showMdLoadingHorizontal(Context context, CharSequence msg, boolean isWhiteBg)
* md风格横向加载框
* @param context
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg
true为白色背景false为灰色背景
public static BuildBean showMdLoadingHorizontal(Context context, CharSequence msg, boolean cancleable, boolean outsideTouchable, boolean isWhiteBg)
DialogUIUtils.showMdLoadingHorizontal(this, "加载中...").show();
竖向加载框
* 竖向加载框
默认白色背景可取消可点击
* @param context 上下文
* @param msg
public static BuildBean showLoadingVertical(Context context, CharSequence msg)
* 竖向加载框 默认可取消可点击
* @param context
* @param msg
* @param isWhiteBg true为白色背景false为灰色背景
public static BuildBean showLoadingVertical(Context context, CharSequence msg, boolean isWhiteBg)
* 竖向加载框
* @param context
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg
true为白色背景false为灰色背景
public static BuildBean showLoadingVertical(Context context, CharSequence msg, boolean cancleable, boolean outsideTouchable, boolean isWhiteBg)
DialogUIUtils.showLoadingVertical(this, "加载中...").show();
md风格竖向加载框
* md风格竖向加载框
默认白色背景可取消可点击
* @param context 上下文
* @param msg
public static BuildBean showMdLoadingVertical(Context context, CharSequence msg)
* md风格竖向加载框 默认可取消可点击
* @param context
* @param msg
* @param isWhiteBg true为白色背景false为灰色背景
public static BuildBean showMdLoadingVertical(Context context, CharSequence msg, boolean isWhiteBg)
* md风格竖向加载框
* @param context
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param isWhiteBg
true为白色背景false为灰色背景
public static BuildBean showMdLoadingVertical(Context context, CharSequence msg, boolean cancleable, boolean outsideTouchable, boolean isWhiteBg)
DialogUIUtils.showMdLoadingVertical(this, "加载中...").show();
md风格弹出框
* md风格弹出框 默认可取消可点击
* @param activity 所在activity
* @param title
标题 不传则无标题
* @param msg
* @param listener 事件监听
public static BuildBean showMdAlert(Activity activity, CharSequence title, CharSequence msg, DialogUIListener listener)
* md风格弹出框
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showMdAlert(Activity activity, CharSequence title, CharSequence msg, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
DialogUIUtils.showMdAlert(activity, "标题", "文本内容", new DialogUIListener() {
public void onPositive() {
public void onNegative() {
}).show();
md风格多选框
* md风格多选框
默认可取消可点击
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param words
* @param checkedItems 默认选中项
* @param listener
public static BuildBean showMdMultiChoose(Activity activity, CharSequence title, CharSequence[] words, boolean[] checkedItems, DialogUIListener listener)
* md风格多选框
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param words
* @param checkedItems
默认选中项
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showMdMultiChoose(Activity activity, CharSequence title, CharSequence[] words, boolean[] checkedItems, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
String[] words = new String[]{"1", "2", "3"};
boolean[] choseDefault = new boolean[]{false, false, false};
DialogUIUtils.showMdMultiChoose(activity, "标题", words, choseDefault, new DialogUIListener() {
public void onPositive() {
public void onNegative() {
}).show();
默认可取消可点击
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param defaultChosen 默认选中项
* @param words
* @param listener
public static BuildBean showSingleChoose(Activity activity, CharSequence title, int defaultChosen, CharSequence[] words, DialogUIItemListener listener)
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param defaultChosen
默认选中项
* @param words
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showSingleChoose(Activity activity, CharSequence title, int defaultChosen, CharSequence[] words, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
String[] words2 = new String[]{"1", "2", "3"};
DialogUIUtils.showSingleChoose(activity, "单选", 0, words2, new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
showToast(text + "--" + position);
}).show();
提示弹出框
* 提示弹出框 默认可取消可点击
* @param activity 所在activity
* @param title
标题 不传则无标题
* @param listener 事件监听
public static BuildBean showAlert(Activity activity, CharSequence title, CharSequence msg, DialogUIListener listener)
* 提示弹出框
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showAlert(Activity activity, CharSequence title, CharSequence msg, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
DialogUIUtils.showAlert(activity, "标题", "文本内容", new DialogUIListener() {
public void onPositive() {
public void onNegative() {
}).show();
横向弹出框
* 横向弹出框
默认可取消可点击
* @param activity 所在activity
* @param title
标题 不传则无标题
* @param msg
* @param listener 事件监听
public static BuildBean showAlertHorizontal(Context activity, CharSequence title, CharSequence msg, DialogUIListener listener)
* 横向弹出框
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showAlertHorizontal(Context activity, CharSequence title, CharSequence msg, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
DialogUIUtils.showAlertHorizontal(activity, "标题", "文本内容", new DialogUIListener() {
public void onPositive() {
public void onNegative() {
}).show();
竖向弹出框
* 竖向弹出框
默认可取消可点击
* @param activity 所在activity
* @param title
标题 不传则无标题
* @param msg
* @param listener 事件监听
public static BuildBean showAlertVertical(Context activity, CharSequence title, CharSequence msg, DialogUIListener listener)
* 竖向弹出框
* @param activity
所在activity
* @param title
标题 不传则无标题
* @param msg
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showAlertVertical(Context activity, CharSequence title, CharSequence msg, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
DialogUIUtils.showAlertVertical(activity, "标题", "文本内容", new DialogUIListener() {
public void onPositive() {
public void onNegative() {
}).show();
中间弹出列表
* 中间弹出列表 默认可取消可点击
* @param context
* @param words
* @param listener 事件监听
public static BuildBean showCenterSheet(Context context, List&? extends CharSequence& words, DialogUIItemListener listener)
* 中间弹出列表
* @param context
* @param words
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showCenterSheet(Context context, List&? extends CharSequence& words, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
List&String& strings = new ArrayList&&();
strings.add("1");
strings.add("2");
strings.add("3");
DialogUIUtils.showCenterSheet(activity, strings, new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
public void onBottomBtnClick() {
}).show();
带取消的底部弹出列表
* 带取消的底部弹出列表 默认可取消可点击
* @param context
* @param words
* @param bottomTxt 底部按钮文本
* @param listener
public static BuildBean showBottomSheetAndCancel(Context context, List&? extends CharSequence& words, CharSequence bottomTxt, DialogUIItemListener listener)
* 带取消的底部弹出列表
* @param context
* @param words
* @param bottomTxt
底部按钮文本
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showBottomSheetAndCancel(Context context, List&? extends CharSequence& words, CharSequence bottomTxt, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
List&String& strings = new ArrayList&&();
strings.add("1");
strings.add("2");
strings.add("3");
DialogUIUtils.showBottomSheetAndCancel(activity, strings, "取消", new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
public void onBottomBtnClick() {
}).show();
底部弹出列表
* 底部弹出列表 默认可取消可点击
* @param context
* @param datas
集合需要BottomSheetBean对象
* @param listener 事件监听
public static BuildBean showBottomSheet(Activity context, List datas, DialogUIItemListener listener)
* 底部弹出列表
* @param context
* @param datas
集合需要BottomSheetBean对象
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showBottomSheet(Activity context, List datas, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
List&BottomSheetBean& datass = new ArrayList&&();
datass.add(new BottomSheetBean(0, "1"));
datass.add(new BottomSheetBean(0, "2"));
datass.add(new BottomSheetBean(0, "3"));
DialogUIUtils.showBottomSheet(this, datass, new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
}).show();
* 输入框 默认可取消可点击
* @param context
* @param title
* @param hint1
第一个文本框提示语
* @param hint2
第二个文本框提示语
* @param firstTxt
第一个按钮文本
* @param secondTxt 第二个按钮文本
* @param listener
public static BuildBean showAlertInput(Context context, CharSequence title, CharSequence hint1, CharSequence hint2, CharSequence firstTxt, CharSequence secondTxt, DialogUIListener listener)
* @param context
* @param title
* @param hint1
第一个文本框提示语
* @param hint2
第二个文本框提示语
* @param firstTxt
第一个按钮文本
* @param secondTxt
第二个按钮文本
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showAlertInput(Context context, CharSequence title, CharSequence hint1, CharSequence hint2, CharSequence firstTxt, CharSequence secondTxt, boolean cancleable, boolean outsideTouchable, DialogUIListener listener)
DialogUIUtils.showAlertInput(activity, "登录", "请输入用户名", "请输入密码", "登录", "取消", new DialogUIListener() {
public void onPositive() {
public void onNegative() {
public void onGetInput(CharSequence input1, CharSequence input2) {
}).show();
md风格竖向底部弹出列表
* md风格竖向底部弹出列表 默认可取消可点击
* @param context
* @param title
* @param datas
集合需要BottomSheetBean对象
* @param bottomTxt 底部item文本
* @param listener
public static BuildBean showMdBottomSheetVertical(Context context, CharSequence title, List datas, CharSequence bottomTxt, DialogUIItemListener listener)
* md风格竖向底部弹出列表
* @param context
* @param title
* @param datas
集合需要BottomSheetBean对象
* @param bottomTxt
底部item文本
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showMdBottomSheetVertical(Context context, CharSequence title, List datas, CharSequence bottomTxt, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
List&BottomSheetBean& datass = new ArrayList&&();
datass.add(new BottomSheetBean(0, "1"));
datass.add(new BottomSheetBean(0, "2"));
datass.add(new BottomSheetBean(0, "3"));
DialogUIUtils.showMdBottomSheetVertical(this, datass, new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
}).show();
md风格横向底部弹出列表
* md风格横向底部弹出列表 默认可取消可点击
* @param context
* @param title
* @param datas
集合需要BottomSheetBean对象
* @param bottomTxt
底部item文本
* @param columnsNum
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showMdBottomSheetHorizontal(Context context, CharSequence title, List datas, CharSequence bottomTxt, int columnsNum, DialogUIItemListener listener)
* md风格横向底部弹出列表
* @param context
* @param title
* @param datas
集合需要BottomSheetBean对象
* @param bottomTxt
底部item文本
* @param columnsNum
* @param cancleable
true为可以取消false为不可取消
* @param outsideTouchable true为可以点击空白区域false为不可点击
* @param listener
public static BuildBean showMdBottomSheetHorizontal(Context context, CharSequence title, List datas, CharSequence bottomTxt, int columnsNum, boolean cancleable, boolean outsideTouchable, DialogUIItemListener listener)
List&BottomSheetBean& datass = new ArrayList&&();
datass.add(new BottomSheetBean(0, "1"));
datass.add(new BottomSheetBean(0, "2"));
datass.add(new BottomSheetBean(0, "3"));
DialogUIUtils.showMdBottomSheetHorizontal(this, datass, new DialogUIItemListener() {
public void onItemClick(CharSequence text, int position) {
}).show();
项目地址:
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:54079次
排名:千里之外
原创:36篇
评论:46条
(3)(15)(1)(2)(2)(4)(1)(9)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'

我要回帖

更多关于 android 弹出框 的文章

 

随机推荐