使用Activity完成以下功能

本文详细介绍了如何在Android应用中使用Activity实现页面布局、电话拨打、短信发送和相机拍照功能。通过Activity之间的值传递,实现从另一Activity获取号码进行电话拨打和短信发送。同时,展示了启动相机拍照并将照片显示在ImageView中的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


1)可以从另一个Activity中,获得的不同的电话号码,实现电话拨打。

2)可以打开相机拍照后,显示在图片框

3)可以发送短信

4)界面如图所示

在这里插入图片描述

一、页面布局

上代码

<?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"
    tools:context=".MainActivity"
    android:orientation="vertical">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageButton
            android:id="@+id/btn_call"
            android:layout_width="135dp"
            android:layout_height="100dp"
            android:layout_alignParentLeft="true"
            android:background="@mipmap/phonecall" />

        <ImageButton
            android:id="@+id/btn_mail"
            android:layout_width="135dp"
            android:layout_height="100dp"
            android:layout_centerInParent="true"
            android:background="@mipmap/message" />
        <ImageButton
            android:id="@+id/btn_camera"
            android:layout_width="140dp"
            android:layout_height="100dp"
            android:layout_alignParentRight="true"
            android:background="@mipmap/camera"
            />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="20dp">
        <EditText
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:id="@+id/et_phone1"
            android:textSize="20sp"
            android:onClick="onClick"
            android:hint="phoneNum"/>

    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值