完成效果:拨打电话,发送短信,播放音乐,播放视频,打开网页,查看图片,通知栏。
PopWindow中完成效果:拍照片,从相册选择照片并且可裁减。
首先在清单文件中加入如下权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
主布局:
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.administrator.jreduch07.IntentActivity">
<com.example.administrator.jreduch07.RoundImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/riv"
android:src="@mipmap/ruzixiaoge"
android:layout_below="@+id/bt8"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt1"
android:text="拨打电话"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt2"
android:text="发送短信"
android:layout_below="@+id/bt1"
android:layout_alignParentStart="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt3"
android:layout_below="@id/bt2"
android:text="打开网页"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt4"
android:layout_below="@+id/bt3"
android:text="播放音乐"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt5"
android:layout_below="@id/bt4"
android:text="播放视频"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt6"
android:layout_below="@id/bt5"
android:text="查看图片"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt7