一、完成目的
在添加多个学会姓名、专业后点击发送信息、在第二个界面上显示多个学生信息
二、工程建立
我们需要两个Activity来建立他们之间的参数传递
因此我们需要新建两个Activity,同时我们还需要一个类来进行对象的传递

三、主界面布局
<?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="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/name"
android:hint="姓名"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/major"
android:hint="专业"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"

该博客旨在介绍如何在Android应用中实现Activity之间的参数传递。作者通过创建两个Activity,利用对象类和接口,实现了从主界面输入的学生信息在第二界面的显示。详细步骤包括工程建立、主界面和第二界面布局、功能实现(包括数据集合和信息读取)以及最终的效果演示。
834

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



