android studio创建学号姓名的输入框代码
时间: 2023-03-29 15:04:37 浏览: 87
您可以使用以下代码创建学号和姓名的输入框:
XML 代码:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/editText_student_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入学号"/>
<EditText
android:id="@+id/editText_student_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入姓名"/>
</LinearLayout>
Java 代码:
EditText editTextStudentId = findViewById(R.id.editText_student_id);
EditText editTextStudentName = findViewById(R.id.editText_student_name);
String studentId = editTextStudentId.getText().toString();
String studentName = editTextStudentName.getText().toString();
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)