Skip to content

I want to use LongClick #31

Open
Open

Description

@ryu884

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.

Activity

  1. ryu884 commented on Sep 27, 2019

    @ryu884
    Author

    `<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>
    `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions