android Dialog 自定义 实现xml
来源:互联网 发布:网络电视提示解压失败 编辑:程序博客网 时间:2024/05/21 18:46
//自定义布局文件
final Dialog dialog = new Dialog(this);
dialog.setTitle("输入用户信息");
dialog.setContentView(R.layout.dialog);
dialog.show();
Button bntOk = (Button)dialog.findViewById(R.id.button1);
bntOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
Button bntCancel = (Button)dialog.findViewById(R.id.button2);
bntCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/dialog"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="用户名:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:ems="10" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="密 码:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="确定" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="取消" />
</LinearLayout>
</LinearLayout>
- android Dialog 自定义 实现xml
- Android自定义dialog实现
- Android 自定义Dialog的实现
- 自定义Dialog android Dialog
- android的自定义dialog对话框实现
- Android多种方式实现自定义Dialog对话框
- Android多种方式实现自定义Dialog对话框
- Android 自定义Dialog 实现类似ios7 UIAlertView
- Android多种方式实现自定义Dialog对话框
- Android中Dialog实现自定义弹出对话框
- android 自定义dialog的简单实现
- Android自定义Dialog实现弹出二维码效果
- Android 自定义Dialog的简单实现
- Android 推荐的自定义 Dialog 实现方式
- Android实现自定义圆角对话框Dialog
- Android 自定义Dialog实现步骤及封装
- 【Android】Dialog以及自定义Dialog
- android 系统Dialog,自定义Dialog
- RSA加密算法加密与解密过程解析
- java基础知识
- C++抛出异常和捕获异常
- shell中if做比较
- 画板子中…
- android Dialog 自定义 实现xml
- <数据结构> 实验二 线性表的实验之二
- Android开发书籍推荐
- C++函数重载
- Python 检查数组元素是否存在 类PHP isset()
- Link inside of input tag
- C++函数模板template
- 非递归的二叉搜索树的中序遍历
- date命令的帮助信息