所需要的权限:
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
xml文件:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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="fanggao.qf.sensor.MainActivity"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="200dp" android:layout_height="200dp" android:layout_marginTop="150dp" android:layout_marginLeft="80dp" android:src="@mipmap/down"/> <ImageView android:id="@+id/image_up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yaoyiyao"/> <ImageView android:id="@+id/image_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/yaoyiyao"/> </FrameLayout> </LinearLayout>