开发者

Adding gestureoverlayview on top of an existing screen

I am trying to add a gestureoverlayview on top of my existing activity but this is not working.

            LayoutInflater li = getLayoutInflater();
            v = li.inflate(R.layout.main, null);
            TextView tv = (TextView)v.findViewById(R.id.icon_text);
            tv.setText("Profile "+position);
            ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
            iv.setImageResource(R.drawable.icon);
            ov = (GestureOverlayView)v.findViewById(R.id.overlay);     
            ov.addOnGesturePerformedListener(this);

I am adding my gestureview like this.It only shows the icon and i am unable to write on the screen.What am i doing开发者_运维知识库 wrong?

         <?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">

                 <android.gesture.GestureOverlayView

    android:id="@+id/overlay" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:gestureStrokeType="multiple"
    android:eventsInterceptionEnabled="true" android:orientation="vertical">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/widget44" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:orientation="vertical"
        android:layout_x="201px" android:layout_y="165px" android:gravity="center_horizontal">




        <ImageView android:id="@+id/icon_image"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
        </ImageView>






        <TextView android:id="@+id/icon_text" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:text="TextView"
            android:gravity="center_horizontal" android:textColorHighlight="#656565">
        </TextView>


    </LinearLayout>
</android.gesture.GestureOverlayView>


      </LinearLayout>


It would depend on your layout: see my answer from Add OnGestureListener to Button? for detail as to how to do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜