使用Activity完成以下功能
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"/>
</LinearLayout>
<ImageView

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

2195

被折叠的 条评论
为什么被折叠?



