多界面跳转的步骤:
一,在layout布局中编辑好布局
二,在src文件夹下写逻辑
三,设置权限
四,在清单文件下注册新建的Activity
1,<activity android:name="com.example.jump.homeActivity" ></activity>
2,<activity android:name="com.example.jump.phoneActivity"></activity>
3,<activity android:name="com.example.jump.sdCardActivity"></activity>
4.<activity android:name="com.example.jump.smsActivity"></activity>
下面模拟了一个多界面跳转的实例,从启动页跳转到第二个界面,然后分别跳转到发短信的界面,打电话的界面,获取手机内存的界面。
布局和代码如下:
MainActivity布局中:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:src="@drawable/qidong2"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_world" />
<Button
android:id="@+id/bt_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/start"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
第二个界面布局中:
<?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"
android:orientation="vertical"
android:background="#44f0f0">
<Button
android:id="@+id/bt_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send"
android:layout_marginTop="30dp"
android:onClick="open01"
/>
<Button
android:id="@+id/bt_call"
android:layout_width="match_parent"<