Android studio实现多个按钮跳转多个页面_android studio仿什么什么,实现多个页面的跳转-程序员宅基地

技术标签: android studio  Android  

Android studio实现多个按钮跳转多个页面

Android studio通过多个按钮实现多个页面的跳转

要求下一个页面有音频、图片、单选按钮(RadioGroup)和复选框(CheckBox),还要求有文本输入框(EditText)和Bundle类及应用Intent传递数据。

其共有五个页面,一应俱全,望对其有帮助!

久违的更新,直接来干货,原项目已上传资源库,有问题私信V:mutou88848
在这里插入图片描述

一、实现效果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、布局配置文件

1、Text.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
    android:orientation="vertical"
    android:background="@drawable/abc">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="67dp"
        android:gravity="center"
        android:text="Android实践示例"
        android:textColor="#FFD700"
        android:textSize="32sp" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="77dp"
        android:src="@drawable/bbb" />

    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人音乐"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn2"
        android:layout_width="wrap_content"
        android:layout_height="47dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人相册"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn3"
        android:layout_width="wrap_content"
        android:layout_height="47dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人信息"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn4"
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="用户登录"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:layout_width="133dp"
        android:layout_height="40dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="41dp"
        android:layout_marginRight="8dp"
        android:ems="10"
        android:gravity="center"
        android:text="字典查词"
        android:textColor="#FF5722"
        android:textSize="20sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />


    <EditText
        android:id="@+id/edit"
        android:layout_width="220dp"
        android:layout_height="60dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="41dp"
        android:layout_marginRight="8dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="请输入你要查询的词组"
        android:textSize="18sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txt2" />

    <Button
        android:id="@+id/btn5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="查询"
        android:layout_margin="10dp"
        android:background="@drawable/tuh"
        android:textColor="#ffff"
        android:textSize="24sp" />

<!--    <ImageView-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="103dp"-->
<!--        android:src="@drawable/qqqq" />-->
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/qqqq"/>


</LinearLayout>
</ScrollView>

2、text1.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="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="80dp">

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/tt" />
    <TextView
        android:id="@+id/txt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="播放音乐"
        android:textSize="24sp" />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageButton
            android:id="@+id/Start"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/music_play" />
        <ImageButton
            android:id="@+id/Stop"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/music_stop" />
        <Button
            android:id="@+id/btn11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="返回"
            android:textSize="24sp"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="40dp"
            android:layout_marginLeft="3dp"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"/>
    </LinearLayout>
</LinearLayout>

3、text2.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"
    android:background="@drawable/abc"
    android:id="@+id/img">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="206dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/aaaa"
        tools:ignore="MissingConstraints" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="277dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/dddd"
        tools:ignore="MissingConstraints" />
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/qqqq"
        tools:ignore="MissingConstraints" />
    <Button
        android:id="@+id/btn11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="返回"
        android:textSize="24sp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="40dp"
        android:layout_marginLeft="3dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>

</LinearLayout>

4、text3.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
    >
    <!--androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"/-->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册登记信息!"
            android:textSize="34sp"
            android:textStyle="bold"
            android:layout_gravity="center"
            android:textColor="#F44336"
            android:gravity="center"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="个人信息:"
            android:textColor="#FF9966"
            android:textSize="24sp"
            android:textStyle="bold" />


        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="1.姓名:"

            android:textColor="#254CC4"
            android:textSize="14sp" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:drawableLeft="@drawable/yonghu"
            android:hint="Name"
            android:drawablePadding="10dp"
            android:inputType="textPersonName"
            />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="2.学校:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:hint="School"
            android:drawablePadding="10dp"
            android:drawableLeft="@drawable/school"
            android:inputType="textPersonName"
            />
        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="3.电话:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />

        <EditText
            android:id="@+id/editText3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:hint="Tell"
            android:drawableLeft="@drawable/tel"
            android:drawablePadding="10dp"
            android:inputType="phone"
            />
        <RadioGroup
            android:layout_marginTop="10dp"
            android:id="@+id/rg_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >
            <TextView
                android:id="@+id/textView6"
                android:layout_width="wrap_content"
                android:layout_height="32dp"
                android:layout_marginTop="10dp"
                android:text="4.性别:"
                android:textColor="#093A9C"
                android:textSize="14sp"
                />

            <RadioButton
                android:id="@+id/rb_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="男生"
                android:layout_marginTop="10dp"
                android:textSize="14sp"
                android:checked="true"
                />
            <RadioButton
                android:id="@+id/rb_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="女生"
                android:textSize="14sp"
                android:layout_marginTop="10dp"
                />
        </RadioGroup>
        <TextView
            android:id="@+id/textView7"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="5.是否有以下情况:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />
        <CheckBox
            android:id="@+id/cb1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否是大学生?"
            android:textSize="14sp"
            android:checked="true"
            android:textColor="#9C27B0"
            />

        <CheckBox
            android:id="@+id/cb2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否是帅哥?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            android:checked="true"
            />
        <CheckBox
            android:id="@+id/cb3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否在宿舍学习?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            />
        <CheckBox
            android:id="@+id/cb4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否打游戏?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            />

        <!--Button
            android:id="@+id/button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="提交"
            android:textSize="20dp"
            android:textColor="#AF1237"/-->

        <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="返回!"
            android:layout_margin="10dp"
            android:background="@drawable/tuh"
            android:textColor="#ffff"
            android:textSize="24sp"

            />
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/www"/>
    </LinearLayout>

</ScrollView>

5、text4.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:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:src="@drawable/login_man"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="48dp"/>
    <EditText
        android:id="@+id/login_id"
        android:layout_width="320dp"
        android:layout_height="48dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="48dp"
        android:background="@drawable/login_div_bg"
        android:paddingLeft="8dp"
        android:text="请输入账号" />
    <EditText
        android:id="@+id/login_password"
        android:layout_width="320dp"
        android:layout_height="48dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="16dp"
        android:background="@drawable/login_div_bg"
        android:paddingLeft="8dp"
        android:text="请输入密码" />
    <Button
        android:id="@+id/login_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="登录"
        android:textSize="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="155dp"/>
</LinearLayout>

6、text5.xml

<?xml version="1.0" encoding="utf-8"?>
<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">-->

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:text="欢迎来到字典查询"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.508"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.2" />

    <TextView
        android:id="@+id/txt2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textSize="24sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintVertical_bias="0.3" />

    <Button
        android:id="@+id/btn6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="248dp"
        android:layout_marginLeft="8dp"
        android:text="返回到字典"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.478"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

三、逻辑控制代码

1、main.java

package com.example.test;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class main extends AppCompatActivity {
    
    Button btn1,btn2,btn3,btn4,btn5;
    EditText edit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);

        setContentView(R.layout.text);

        btn1 = (Button) findViewById(R.id.btn1);
        btn2 = (Button) findViewById(R.id.btn2);
        btn3 = (Button) findViewById(R.id.btn3);
        btn4 = (Button) findViewById(R.id.btn4);
        btn5 = (Button) findViewById(R.id.btn5);
        edit=(EditText)findViewById(R.id.edit);

        btn1.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText1.class);
                startActivity(intent);
            }
        });
        btn2.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText2.class);
                startActivity(intent);
            }
        });
        btn3.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText3.class);
                startActivity(intent);
            }
        });
        btn4.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText4.class);
                startActivity(intent);
            }
        });
        btn5.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText5.class);
                Bundle bundle = new Bundle();
                bundle.putString("edit", edit.getText().toString());
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }


}

2、maintext1.java

package com.example.test;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainText1 extends Activity {
    
    ImageButton Start,Stop;
    MediaPlayer mp;
    Button btn1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text1);

        Start=(ImageButton)findViewById(R.id.Start);
        Stop=(ImageButton)findViewById(R.id.Stop);

        Start.setOnClickListener(new mStart());
        Stop.setOnClickListener(new mStop());

        try {
    
            mp= MediaPlayer.create(this, R.raw.abc);
            mp.setLooping(true);
        }
        catch(Exception e){
    
            Toast.makeText(this,"play error", Toast.LENGTH_LONG).show();
        }
    }
    class mStart implements View.OnClickListener{
    
        @Override
        public void onClick(View v) {
    
            try {
    
                if(!mp.isPlaying()){
    
                    mp.start();
                    Start.setImageResource(R.drawable.music_pause);
                }
                else {
    
                    mp.pause();
                    Start.setImageResource(R.drawable.music_play);
                }
            }
            catch(Exception e){
    e.printStackTrace();}
        }
    }
    class mStop implements View.OnClickListener{
    
        @Override
        public void onClick(View v) {
    
            mp.reset();
            try {
    
                mp = MediaPlayer.create(MainText1.this, R.raw.abc);
                mp.setLooping(true);
            }
            catch(Exception e){
     e.printStackTrace();}
            Start.setImageResource(R.drawable.music_play);
        }
    }

}

3、maintext2.java

package com.example.test;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;


import androidx.appcompat.app.AppCompatActivity;

import java.util.ResourceBundle;

public class MainText2 extends AppCompatActivity implements View.OnClickListener {
    
    Button btn11;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text2);

    }

    @Override
    public void onClick(View v) {
    

    }
}

4.maintext3.java

package com.example.test;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainText3 extends AppCompatActivity implements View.OnClickListener {
    
    Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text3);

    }

    @Override
    public void onClick(View v) {
    

    }
}

5、maintext4.java

package com.example.test;
import android.app.Activity;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainText4 extends AppCompatActivity implements View.OnClickListener
{
    
    Button btn;
    EditText login_id,login_password;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text4);
        login_id = (EditText) findViewById(R.id.login_id);
        login_password = (EditText) findViewById(R.id.login_password);
        btn = (Button) findViewById(R.id.login_button);
        btn.setOnClickListener(this);
    }
    @Override
    public void onClick(View v)
    {
    
        String  str = login_id.getText()+" "+login_password.getText();
        Toast.makeText(this,str,Toast.LENGTH_LONG).show();
    }

}

6、maintext5.java

package com.example.test;
import android.content.Intent;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainText5 extends AppCompatActivity implements View. OnClickListener{
    
    Button btn6;
    TextView txt2;
    @Override
    public void onCreate(Bundle bunde) {
    
        super.onCreate(bunde);
        setContentView(R.layout.text5);
        txt2=(TextView)findViewById(R.id.txt2);
        btn6 = (Button)findViewById(R.id.btn6);
        Bundle bb = this.getIntent().getExtras();
        String str = bb.getString("edit");
        txt2.setText(str);
        btn6.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
    
        Intent intent2 = new Intent();
        intent2.setClass(this, main.class);
        startActivityForResult(intent2,0);//返回前一页面界面
    }
}

四、配置信息文件AndroidMAnifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Test">
        <activity android:name=".main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainText1"></activity>
        <activity android:name=".MainText2"></activity>
        <activity android:name=".MainText3"></activity>
        <activity android:name=".MainText4"></activity>
        <activity android:name=".MainText5"></activity>
    </application>

</manifest>

在这里插入图片描述

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/wkt1105436760/article/details/116810593

智能推荐

2021-07-16操作系统中对系统调用和进程,线程的一些知识_触发一个系统调用就创建一个内核线程吗-程序员宅基地

文章浏览阅读391次。系统调用1.系统调用的相关处理需要在核心态下进行2.系统调用与库函数的区别:用户的代码如write()就是一个库函数,然后由库函数write去进行系统调用,所以系统调用发生在用户态,对系统调用的处理发生在核心态。进程进程的定义1.进程(进程实体是在内存中由分配的数据段,代码段和PCB组成的)注意:PCB是进程存在的唯一标志,所谓创建进程就是创建实体中的PCB。 进程的管理者—操作系统,所需的数据都在PCB中(可将PCB看成一个ip报文)2.区分进程和进程实体:进程是动态的,进程实体是静_触发一个系统调用就创建一个内核线程吗

fopen,fwrite,fread,的详细用法....._fwrite w+-程序员宅基地

文章浏览阅读348次。fopen,fwrite,fread,的详细用法#include <stdio.h>FILE *fopen(const char *pathname, const char *mode);FILE *fdopen(int fd, const char *mode);FILE *freopen(const char *pathname, const char *mode, FILE *stream);返回值 ,成功为文件指针,失败为NULL//pathname :路径//mode_fwrite w+

分页jsp代码_jsp分页代码-程序员宅基地

文章浏览阅读141次。简约的分页jsp代码_jsp分页代码

【Linux :编辑文件的方式】_linux 非交互方式修改文件-程序员宅基地

文章浏览阅读815次。一般可以把文件用sftp方式下载下来,在本地电脑修改好后再上传上去, 但有时候可能必须在linux里面修改,在Linux里面修改涉及到两种方式第一种:vi/vim两个常用linux端文本编辑工具, vi/vim 编辑工具1.vi/vim是什么?①vi是Visual Interface的缩写,即 可视化接口②vim是vi iMprove的缩写,即 vi的增强版(具有语法着色功能)2.vim模式有哪些?如何切换?①三种模式命令模式(默认):刚进入vim的时候,默认就是 命令模式,可以复制行,删除_linux 非交互方式修改文件

Imagination先进半导体IP引领汽车智能化发展 | IC China2020-程序员宅基地

文章浏览阅读155次。10月14-16日,由中国半导体行业协会、中国电子信息产业发展研究院主办的第三届全球IC企业家大会暨第十八届中国国际半导体博览会(IC China 2020)在上海新举行。本届大会暨博览..._imagination的半导体接口ip

Linux基础入门_linux license agreement-程序员宅基地

文章浏览阅读251次。Linux基础入门及安装虚拟机、操作系统_linux license agreement

随便推点

树莓派开发6-配置树莓派的Linux内核_树莓派linux内核配置-程序员宅基地

文章浏览阅读149次。文章目录配置树莓派的Linux内核树莓派Linux内核编译文件系统Linux内核驱动基础框架驱动测试步骤树莓派学习笔记,本文图片文字皆为转述配置树莓派的Linux内核驱动两种加载方式: * 编译进内核 zImage包含了驱动 M 模块方式生成驱动文件xxx.ko 系统启动后,通过命令inmosd xxx.ko 加载内核配置: ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KERNEL=kernel7 make bcm2709_defconfi_树莓派linux内核配置

android9.0客制化开关机动画_开机动画客制化-程序员宅基地

文章浏览阅读869次。由于android p的代码不同于以往低版本的代码直接可以cp过去,而是在代码的编译同事check一下,多了这一个动作就导致p内置app的时候编译不过的问题,而且错误也是让人摸着头脑,特记录下以防再次出错并回忆学习。需要在device\project\device.mk中所需要的cp代码#add by lwzPRODUCT_COPY_FILES += $(LOCAL_PATH)/boo..._开机动画客制化

pandas 对列的相关操作_pandas对列操作-程序员宅基地

文章浏览阅读3.3k次,点赞2次,收藏17次。pandas 对列的相关操作_pandas对列操作

酷我音乐爬取 -- python_qobuz爬取教程-程序员宅基地

文章浏览阅读4.7k次,点赞4次,收藏15次。kw爬取 – python文章目录kw爬取 -- python获取歌曲地址:即.mp3地址1、地址在哪?2、寻找规律3、获取rid4、获取地址代码目标:爬取酷我排行榜:http://www.kuwo.cn/rankList获取歌曲地址:即.mp3地址1、地址在哪?随便播放一首歌比如:http://www.kuwo.cn/play_detail/96596360发现歌曲地址在:http..._qobuz爬取教程

Fujitsu(富士通)扫描仪——fi-6130z 无感安装设置_scansnap manager for fi series 1.0.14-程序员宅基地

文章浏览阅读2.4w次,点赞9次,收藏25次。前言众所周知,富士通的扫描仪是真的好用。但是设置也比较繁琐。不富裕的我,弄了一个二手的fi-6130z,在网上找了一圈,发现没有相关的教程,无奈只能官网找客服。客服并没有完全的解答我的疑问,且态度不是很好,让我稍微不爽。所以写下这篇教程,以作参考。准备工作一台 fi-6130z一台PC(以 win10为例)相关驱动及软件..._scansnap manager for fi series 1.0.14

句法分析(PCFG,Transition-based parsing)-程序员宅基地

文章浏览阅读7.5k次,点赞4次,收藏22次。句法分析的基本任务是确定句子的句法结构或者句子中词汇之间的依存关系。  句法分析分为句法结构分析(syntactic structure parsing)和依存关系分析(dependency parsing)。以获取整个句子的句法结构或者完全短语结构为目的的句法分析,被称为成分结构分析(constituent structure parsing)或者短语结构分析(phrase s..._pcfg

推荐文章

热门文章

相关标签