winsontan520 / Android-WScratchView

[Deprecated] Provide a view which can be scratched
83 stars 35 forks source link

Slow Scratch #12

Closed pirakleous closed 4 years ago

pirakleous commented 9 years ago

Hello i have added a layout below the view and when i am trying to scratch is to slow. ( i do the moves and after some time i see the image start scratching).

This is my layout below the scratchview

    <LinearLayout
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/view1"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="130dp"
        android:layout_marginLeft="70dp"
        android:background="@color/white"
        android:orientation="vertical"
        android:id="@+id/linearLayout">

        <LinearLayout
            android:id="@+id/layoutTop"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:orientation="horizontal">

            <View
                android:layout_width="0dp"
                android:layout_height="2dp"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="@color/yellow_default" />

            <ImageView
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/treasure" />

            <View
                android:layout_width="0dp"
                android:layout_height="2dp"
                android:layout_gravity="center"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="@color/yellow_default" />

        </LinearLayout>

        <TextView
            android:id="@+id/txt_winlose"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="5dp"
            android:text="Large Text"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/txt_description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Large Text"
            android:textSize="14sp" />

    </LinearLayout>
gilbert1991 commented 9 years ago

Consider using less hierarchies of layout and set a smaller reveal size

pirakleous commented 9 years ago

I tried it but nothing happens

gilbert1991 commented 9 years ago

I prefer you show the codes

pirakleous commented 9 years ago

hello you are right the problem was at reveal size. its now working with size of 15dp is there any whay this works with bigger size without the delay time?

gilbert1991 commented 9 years ago

I guess the problem is the canvas is drawing in loop in this library. So either modify the source code or use small reveal size.

zjc commented 9 years ago

hi,winsontan520: I have the same issue,when i use match_parent this is my layout:

 <FrameLayout
    android:id="@+id/frame_scratch"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone">

    <!--result image view-->
    <com.welltang.common.widget.ImageLoaderView
        android:id="@+id/image_result"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:visibility="gone" />

    <com.welltang.common.widget.scratch.WScratchView
        android:id="@+id/coverScratchView"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>

</FrameLayout>