Activity页面跳转简单实例


首先要实现一个简单的跳转,肯定需要2个Activity,也就是需要两个控制器类和两个视图xml
test_mainactivity.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/main_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Start SecondActivity"/>
</LinearLayout>
对应控制器Main2Activity:
public class Main2Activity