<androidx.constraintlayout.widget.ConstraintLayout 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”
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:layout_marginRight=“10dp”
android:orientation=“vertical”
android:paddingLeft=“10dp”>
<Button
android:id=“@+id/btn1”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“10dp”
android:text=“Array列表”
android:textAllCaps=“false”/>
</androidx.constraintlayout.widget.ConstraintLayout>
2.创建ArrayList的Activity
3.设置从主Activity跳转到ArrayActivity
代码:
Button button=findViewById(R.id.btn1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(Ma