Android中多界面跳转的一个简单应用

本文详细介绍了在Android中实现多界面跳转的步骤,包括编辑布局、编写逻辑、设置权限、注册Activity。通过实例展示了如何从启动页跳转到其他界面,如发送短信、拨打电话、获取存储空间等,并提供了相应的XML布局代码和Java逻辑代码。
摘要由CSDN通过智能技术生成

 多界面跳转的步骤:

  一,在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"<

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值