balysv / material-ripple

Android L Ripple effect wrapper for Views
Apache License 2.0
2.36k stars 479 forks source link

onClick not working #79

Open Shrinu opened 7 years ago

Shrinu commented 7 years ago

<com.balysv.materialripple.MaterialRippleLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/categoryripple" android:layout_width="match_parent" android:layout_height="wrap_content" app:mrl_rippleAlpha="0.2" app:mrl_rippleColor="@color/colorPrimaryDark" app:mrl_rippleDimension="4dp" app:mrl_rippleDuration="250" app:mrl_rippleInAdapter="true" app:mrl_rippleOverlay="true">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="@android:color/white"
    android:orientation="vertical">

    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_marginLeft="16dp"
        android:layout_toLeftOf="@+id/groupIndicator"
        android:gravity="center_vertical"
        android:text="Test"
        android:textColor="@android:color/black"
        android:textSize="12sp" />

    <ImageView
        android:id="@+id/groupIndicator"
        android:layout_width="10dp"
        android:layout_height="10dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp" />
</RelativeLayout>

</com.balysv.materialripple.MaterialRippleLayout>

public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.category_item, null); } MaterialRippleLayout mRipple = (MaterialRippleLayout) convertView.findViewById(R.id.categoryripple); mRipple.setTag(true); mRipple.setTag(R.id.groupIndicator, groupPosition); mRipple.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showToast(categories.get(groupPosition).getCategory_name()); } }); }

I am using BaseExpandableListAdapter, showtoast is never called. Where I am making mistake not able to find out.

mobileguru007 commented 5 years ago

Duplicate of #86