Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 水平滚动视图滑动/投掷guesture侦听器_Java_Android_Gesture_Horizontalscrollview - Fatal编程技术网

Java 水平滚动视图滑动/投掷guesture侦听器

Java 水平滚动视图滑动/投掷guesture侦听器,java,android,gesture,horizontalscrollview,Java,Android,Gesture,Horizontalscrollview,我知道这是一个常见的问题,但我完全搞不懂网络上的不同示例和教程 我有一个horizontalScrollView,我在其中动态添加了一些视图,我想设置一个guestureListener来浏览这些视图。每个视图的宽度等于屏幕的宽度 您可以使用视图寻呼机而不是水平滚动视图 要使“查看寻呼机”保持在屏幕的一半,请使用以下内容: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:lay

我知道这是一个常见的问题,但我完全搞不懂网络上的不同示例和教程


我有一个horizontalScrollView,我在其中动态添加了一些视图,我想设置一个guestureListener来浏览这些视图。每个视图的宽度等于屏幕的宽度

您可以使用视图寻呼机而不是水平滚动视图

要使“查看寻呼机”保持在屏幕的一半,请使用以下内容:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/White"
android:orientation="vertical">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1.5">

    <android.support.v4.view.ViewPager
        android:id="@+id/pagerPromo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <com.viewpagerindicator.CirclePageIndicator
        android:id="@+id/indicatorPromo"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:padding="5dp"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1.0"
    android:orientation="vertical">


此视图寻呼机底部有一个圆圈指示器,但如果您愿意,可以将其删除。只要玩玩重量游戏,看看什么最适合你。

viewpager不适合你吗?我以前没有做过水平滚动视图,但是viewpagers很容易创建和使用。我可以只在屏幕的一部分而不是整个屏幕上使用浏览寻呼机吗?谢谢你的回答,我现在就试试。但是它对API8有效吗?好的,我现在正在尝试。谢谢