How to set the orientation of the views underneath the Gesture Overlay to “none”

独自空忆成欢 提交于 2020-01-16 04:09:29

问题


I am trying to set the orientation of the views underneath the GestureOverlay to none. At this point I am able to set the orientation to either vertical or horizontal. However, for my application I dont want either, this needs to be set to none.

In the article for gestures API, it says the following:

orientation: indicates the scroll orientation of the views underneath. In this case the list scrolls vertically, which means that any horizontal gestures (like action_delete) can immediately be recognized as a gesture. Gestures that start with a vertical stroke must contain at least one horizontal component to be recognized. In other words, a simple vertical line cannot be recognized as a gesture since it would conflict with the list's scrolling.

And above that it shows this piece of code, displaying the android:orientation as vertical.

<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:gestureStrokeType="multiple"
android:eventsInterceptionEnabled="true"
android:orientation="vertical">

After searching online I found this piece of code for an Android Theme that uses android:orientation="none"

So I tried to implement this into my GestureOverlay, however when I use this it just produces this error in the XML file: error: Error: String types not allowed (at 'orientation' with value 'none'). My code is shown below:

    <android.gesture.GestureOverlayView
android:id="@+id/gestures_alpha"
android:layout_width="fill_parent" 
android:layout_height="0dip"
android:layout_weight="1.0"
android:gestureStrokeType="multiple"
android:fadeOffset="2000"
android:orientation="none"/>

Could someone let me know if there is a work around, or if this is a SDK version problem. I am coding using SDK version 7 (2.1.1).

Thanks


回答1:


The android:orientation="none" option is part of the Replicant project and isn't valid for standard Android builds. In short, the only options you have are horizontal and vertical, sorry.




回答2:


It looks to me like you're trying have both horizontal and vertical gestures being recognized using GestureOverlayView. This is the solution:

gestureOverlayView.setOrientation(GestureOverlayView.ORIENTATION_VERTICAL);
gestureOverlayView.setGestureStrokeAngleThreshold(90); 


来源:https://stackoverflow.com/questions/5923079/how-to-set-the-orientation-of-the-views-underneath-the-gesture-overlay-to-none

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!