AlertDialog 的简单用法效果图
来源:互联网 发布:全国电视台直播软件 编辑:程序博客网 时间:2024/04/29 20:52
效果图
功能
应用AlertDialog实现自定义的登录对话框
Java源码
Button button = (Button)findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(AlertDialogActivity.this); builder.setTitle("用户登录:"); // 设置 longin.xml 界面 LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.login, null); builder.setView(view); //添加确定按钮 builder.setPositiveButton("登录", null); //添加取消按钮 builder.setNegativeButton("退出", null); // 创建对话框并显示 builder.create().show(); } });
XML
<TableLayout android:id="@+id/tableLayout1"android:layout_width="fill_parent" android:layout_height="fill_parent"xmlns:android="http://schemas.android.com/apk/res/android"android:gravity="center_vertical"android:stretchColumns="0,3"><!-- 第一行 --><TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView/><TextView android:text="用户名:" android:id="@+id/textView1" android:layout_width="wrap_content"android:textSize="24px" android:layout_height="wrap_content"/><EditText android:id="@+id/editText1" android:textSize="24px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minWidth="200px"/><TextView /></TableRow><!-- 第二行 --><TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView/><TextView android:text="密 码:" android:id="@+id/textView2" android:textSize="24px" android:layout_width="wrap_content" android:layout_height="wrap_content"/><EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="24px" android:id="@+id/editText2" android:inputType="textPassword"/><TextView /></TableRow></TableLayout>
XML效果图
0 0
- AlertDialog 的简单用法效果图
- AlertDialog的超简单用法
- <AlertDialog>的简单用法与功能
- android学习总结(16.09.08)AlertDialog的简单用法
- Android--AlertDialog的用法
- AlertDialog的各种用法
- AlertDialog的用法
- AlertDialog的用法
- AlertDialog的用法
- AlertDialog的用法
- AlertDialog的简单实例
- AlertDialog的简单学习
- AlertDialog的简单封装
- AlertDialog的简单实用
- AlertDialog的简单使用
- 学做网页简单的效果图 [转]
- 最简单实用的截图工具--效果图
- 关于AlertDialog 的一些用法
- 匹配极其相关问题(一)
- LeetCode 1 - Two Sum ( JAVA )
- CSP考试 2013年12月第4题 C语言实现
- choice 详解
- gmtime和ctime的区别(补)
- AlertDialog 的简单用法效果图
- zynq的uboot编译问题汇总
- [python]flask框架快速入门
- 约瑟夫环【dp】
- 自定义的ArrayList
- ds
- 【April Fools Day Contest 2016A】【OEIS】Da Vinci Powers 达芬奇power
- Eclipse将引用了第三方jar包的Java项目打包成jar文件的两种方法
- 背包问题