android继承Dialog实现自定义对话框
2014-08-25 15:02
585 查看
有时需要自定义对话框,可以使用AlterDialog.Bulider,比如下面的代码片段
上面的代码片段来自:http://blog.csdn.net/chenlei1889/article/details/6267406
这里我要记录的是通过继承Dialog这个类,实现自定义对话框
布局文件menu.xml放在layout文件夹下面
java代码(片段)
new AlertDialog.Builder(self) .setTitle("标题") .setMessage("简单消息框") .setPositiveButton("确定", null) .show();
上面的代码片段来自:http://blog.csdn.net/chenlei1889/article/details/6267406
这里我要记录的是通过继承Dialog这个类,实现自定义对话框
布局文件menu.xml放在layout文件夹下面
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:text="用户名" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/user" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密码" android:textSize="20sp" /> <EditText android:id="@+id/password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:password="true" /> </LinearLayout>
java代码(片段)
MyDialog myDialog = new MyDialog(Activity_First.this); myDialog.show();
相关文章推荐
- Android多种方式实现自定义Dialog对话框
- Android多种方式实现自定义Dialog对话框
- Android底部对话框的实现(BottomSheet,自定义Dialog)
- 完全自定义Android对话框AlertDialog的实现(系统源码)
- Android自定义Dialog实现加载对话框效果
- 完全自定义Android对话框AlertDialog的实现
- Android实现自定义对话框(Dialog)
- android 继承dialog自定义对话框
- Android AlertDialog对话框自定义风格的另类实现
- 完全自定义Android对话框AlertDialog的实现
- Android多种方式实现自定义Dialog对话框
- Android中Dialog实现自定义弹出对话框
- Android多种方式实现自定义Dialog对话框
- Android实现自定义圆角对话框Dialog的示例代码
- Android实现自定义圆角对话框Dialog
- android,自定义无标题对话框(继承Dialog类,非AlertDialog)的样式
- Android UI设计系列之自定义Dialog实现各种风格的对话框效果(7)
- Android AlertDialog对话框自定义风格的另类实现
- Android UI设计之<七>自定义Dialog,实现各种风格效果的对话框
- Android自定义对话框Dialog的简单实现