daimajia / AndroidViewHover

An elegant way to show your menu or messages.
3.21k stars 721 forks source link

I want to use LongClick #31

Open ryu884 opened 4 years ago

ryu884 commented 4 years ago

I want to use OnLongClickListener.

I put an imageview inside the cardview and applied a blurview.

I applied longclick to Cardview. But when I clicked on the imageview, longclick didn't work.

I want to make longclick work when I hit the area of ​​Cardview. However, imageview has blurview, so it does not work in imageview area.

So I tried applying OnLongClickListener to the imageview to solve this.

But when I use OnLongClickListener for imageview, blurview doesn't work.

Please tell me the solution.

ryu884 commented 4 years ago

`<androidx.cardview.widget.CardView android:id="@+id/cardview1" android:foreground="?android:attr/selectableItemBackground" android:layout_width="match_parent" android:layout_height="180dp" xmlns:cardview="http://schemas.android.com/apk/res-auto" android:layout_margin="6dp" cardview:cardCornerRadius="15dp" android:weightSum="10"

<LinearLayout
        android:id="@+id/linear1"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="5"
    >

    <com.daimajia.androidviewhover.BlurLayout
        android:layout_height="wrap_content"
        android:id="@+id/blur_layout"
        android:layout_width="wrap_content"
        >

        <ImageView
            android:id="@+id/book_img_id"
            android:layout_width="match_parent"
            android:layout_height="130dp"
            android:scaleType="centerCrop"
            android:src="@drawable/bird"
            />
    </com.daimajia.androidviewhover.BlurLayout>

        <TextView
            android:id="@+id/book_title_id"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textSize="13dp"
            android:text="Web Hacking"
            android:textColor="#FF000000"
            android:layout_marginRight="7dp"
            android:layout_marginLeft="7dp"
            android:gravity="center_vertical"
            android:maxLines="2"
            android:ellipsize="end"/>

    </LinearLayout>

</androidx.cardview.widget.CardView> `