2017-02-21 3 views
-1

Das Problem ist, als nächstes, wenn ich in ImageViewmIV_WishItem "Herz" eingegeben haben, verursacht onClick Hintergrund ImageViewmIV_WishItemRichtig mit zwei imageView onClick?

enter image description here

Der Code dieses Buttons:

  holder.mIV_WishItem.setOnClickListener(new View.OnClickListener() { 
       @Override 
       public void onClick(View view) { 
        setFavorites(holder, sectionsItem, true); 
       } 
      }); 

      holder.mIV_pictureGoodsItem.setOnClickListener(new View.OnClickListener() { 
       @Override 
       public void onClick(View view) { 
        SectionsItem sectionsItem = sectionsItems.get(position); 
        sectionItemId = sectionsItem.getId(); 

        getDataForItemDetails(mContext); 
       } 
      }); 

und XML für diese Tasten

<RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="@dimen/_200sdp" 
    > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:gravity="end" 
     > 

     <ImageView 
      android:id="@+id/iV_Wish" 
      android:layout_width="@dimen/bottom_navigation_icon" 
      android:layout_height="@dimen/bottom_navigation_icon" 
      /> 
    </LinearLayout> 

    <ImageView 
     android:id="@+id/iV_pictureGoods_Item" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_gravity="center_horizontal" 
     /> 
</RelativeLayout> 
me

Bitte helfen Lösung finden

Antwort

0

Sie benötigen Attribut in Ihrem Image (mIV_WishItem) hinzuzufügen:

android:focusable="true" 
android:focusableInTouchMode="true" 

Viewholder Artikel selbst fokussierbar, so dass wir Fokus auf Imageview einstellen müssen. Danach können wir die Bildansicht aktivieren.

Verwandte Themen