为没有手势的控件(ViewFlipper) 添加手势
xml
<?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:layout_width="match_parent"
android:layout_height="match_parent" tools:context="com.example.mygesture.MainActivity">
<ViewFlipper
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/vf_main_one"
></ViewFlipper>
</LinearLayout>
Activity
控件中,我放入的是手机内存中的所有图片,所有必须先获取读取的权限
在 AndroidManifest.xml 文件中获取权限
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>