android知识点一:自定义xml对话框
来源:互联网 发布:aes算法密钥最小长度 编辑:程序博客网 时间:2024/06/11 00:38
xml自定义对话框
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#ffffff"> <LinearLayout android:layout_width="300dp" android:layout_height="200dp" android:orientation="vertical" android:gravity="center_vertical" > <EditText android:layout_marginTop="30dp" android:layout_marginBottom="30dp" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:hint="请输入账号" /> <EditText android:layout_width="200dp" android:layout_height="wrap_content" android:hint="请输入密码" android:layout_gravity="center_horizontal" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal"> <Button android:id="@+id/my_login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登陆"/> <Button android:id="@+id/my_cancle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="取消"/> </LinearLayout> </LinearLayout> </LinearLayout>
java代码:
private Dialog mDialog;private void showDeleteDlg() {mDialog = new Dialog(MainActivity.this, R.style.Theme_Dialog);mDialog.setCanceledOnTouchOutside(true);View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.xml_dialog, null);login = (Button)view.findViewById(R.id.my_login);cancle = (Button)view.findViewById(R.id.my_cancle);login.setOnClickListener(this);cancle.setOnClickListener(this);mDialog.setContentView(view);mDialog.show();}
style.xml
<style name="Theme_Dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
</style>
最后在附上 图片:
- android知识点一:自定义xml对话框
- [Android 知识点] 自定义View(一)
- Android中自定义对话框(Dialog) <一>
- Androidの自定义对话框AlertDialog(一)
- Android知识点之对话框
- 自定义列表对话框(一)
- android中的对话框:自定义对话框
- android知识点二:ProgressDialog对话框
- Android---功能模块一之颜色选择器自定义Preference 对话框
- android应用开发揭秘学习笔记(Dialog对话框-例2:用xml自定义对话框并调用)
- android读写xml知识点
- Android Dialog( 自定义对话框)
- android 自定义对话框
- android自定义对话框
- Android自定义对话框
- android 自定义对话框
- Android自定义Dialog对话框
- android自定义大小对话框
- 今日所想
- CGAffineTransformMake 矩阵变换 的运算原理
- 备份文件之批处理程序
- 计算机网络的五层协议栈(摘录自计算机网络 自顶向下第四版)
- POJ2075 & TOJ2119 Tangled in Cables
- android知识点一:自定义xml对话框
- hdu 1026 Ignatius and the Princess I
- Linux进程休眠和唤醒
- SQL Server 的恢复和备份模式
- Android在OnCreate中获取控件的宽度和高度
- shell脚本重定向>>, >, 2>>, 2>, &>, &>>
- leetcode minimum window substring
- 对话框程序启动时呈现的状态
- 在 Ubuntu 12.04 LTS 上安装 OpenCV 2.4.1