如何将手势叠加下方的视图方向设置为“无”
我试图将 GestureOverlay 下面的视图方向设置为无。此时,我可以将方向设置为垂直或水平。但是,对于我的应用程序,我也不想要,这需要设置为无。
在手势 API 的 文章 中,内容如下:
orientation:表示滚动方向 下面视图的方向。 在这种情况下,列表滚动 垂直方向,这意味着任何 水平手势(例如 action_delete) 可以立即 被识别为一个手势。手势 必须从竖笔开始 包含至少一个水平方向 被识别的组件。在其他方面 换句话说,一条简单的垂直线不能 被认为是一种手势,因为它 会与列表冲突 滚动。
上面显示了这段代码,将 android:orientation 显示为垂直。
<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">
在线搜索后,我发现了一段使用 android 的 Android 主题代码:orientation="none"
所以我尝试将其实现到我的 GestureOverlay 中,但是当我使用它时,它只会在 XML 文件中产生此错误: error: Error: String types not allowed (at 'orientation ',值为“none”)。 我的代码如下所示:
<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"/>
有人可以告诉我是否有解决方法,或者这是否是 SDK 版本问题。我正在使用 SDK 版本 7 (2.1.1) 进行编码。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
android:orientation="none"
选项是 Replicant 项目 的一部分,并且不是对于标准 Android 版本无效。简而言之,抱歉,您唯一的选择是水平和垂直。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.在我看来,您正在尝试使用 GestureOverlayView 识别水平和垂直手势。这是解决方案:
It looks to me like you're trying have both horizontal and vertical gestures being recognized using GestureOverlayView. This is the solution: