GestureOverlayView在布局上无法正常工作

时间:2014-06-27 10:18:42

标签: android gesture

我目前正在开展一个包含手势的项目。它完美的工作,但我想在手势上放置填充或边距,但不是我想要的布局更改。如何在手势中添加填充或边距?

我的xml代码:

<FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1.50"
            android:layout_marginTop="5dp"
            android:layout_gravity="center" >

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/bg_alpha"
                android:layout_gravity="center"
                android:contentDescription="@string/app_name" >
            </ImageView>

            <android.gesture.GestureOverlayView
                android:id="@+id/draw_on_gesture"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="15dp"
                android:background="@drawable/a_draw" 
                android:eventsInterceptionEnabled="true">
            </android.gesture.GestureOverlayView>

        </FrameLayout>

1 个答案:

答案 0 :(得分:1)

看看这个:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<android.gesture.GestureOverlayView
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gestureStrokeType="multiple"
android:eventsInterceptionEnabled="true"/>
</LinearLayout>

另请参阅this link,它也可能有所帮助。

相关问题