一、内容
设计两种形式的对话框程序,一种是发出提示信息的普通对话框,另一种是用户登录对话框。
二、实现
1.主界面 activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="打开普通对话框"
android:textSize="20sp"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="打开输入对话框"
android:textSize="20sp"/>
</LinearLayout>
2.登录对话框的界面布局文件 login.xml
<?xml vers

本文展示了如何在Android Studio中创建两种对话框:普通提示信息对话框和用户登录对话框。详细讲解了activity_main.xml的主界面设计,login.xml的登录界面布局,以及MainActivity.java中的主控制程序实现。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



