Android Material Ripple Layout ArrayAdapter setonitemclicklistener not working












2















I import this library to my android project. 'com.balysv:material-ripple:1.0.1'
and I want to use in listview. ripple works fine but when I touch listview setinotemclicklistener not working. this is my code.



public class Jobs extends Activity {

ListView listOfJobs;
LinearLayout llBack;
//boolean bolSubGroup = {false,false,false,true,false,true,false,true,true,false,false,false,true};
ArrayList<String> lstID = new ArrayList<String>();
ArrayList<String> lstTitle = new ArrayList<String>();
ArrayList<Integer> lstSubggroup = new ArrayList<Integer>();
String strTitle;
Integer intSubgroup ;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.jobs);
ListJobs();
strTitle = new String[lstTitle.size()];
intSubgroup = new Integer[lstSubggroup.size()];


lstTitle.toArray(strTitle);
lstSubggroup.toArray(intSubgroup);
listOfJobs = (ListView) findViewById(R.id.lstv_Jobs);
LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(Jobs.this,
R.animator.in_from_right2), 0.8f); //0.5f == time between appearance of listview item
listOfJobs.setLayoutAnimation(lac);
listOfJobs.setAdapter(new JobsAdapter1(this, R.layout.jobs_single_row,
R.id.txv_Jobs_SR, R.id.img_Jobs_SR, strTitle, intSubgroup));
listOfJobs.setOnItemClickListener(this);

llBack = (LinearLayout) findViewById(R.id.lil_Jobs_Top);
llBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibe.vibrate(20);
finish();
}
});






listOfJobs.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

});//*/
}


my array adapter



class JobsAdapter1 extends ArrayAdapter  {
Activity context;
String items;
Integer arrows;
int layoutId;
int textId;
int imageId;

JobsAdapter1(Activity context, int layoutId, int textId, int imageId, String items, Integer arrows)
{
super(context, layoutId, items);

this.context = context;
this.items = items;
this.arrows = arrows;
this.layoutId = layoutId;
this.textId = textId;
this.imageId = imageId;

}

private class ViewHolder {
TextView txtitems;
ImageView img;
}

public View getView(int pos, View convertView, ViewGroup parent)
{


LayoutInflater inflater = context.getLayoutInflater();
ViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.jobs_single_row, null);
holder = new ViewHolder();
holder.txtitems = (TextView) convertView.findViewById(R.id.txv_Jobs_SR);
holder.img = (ImageView) convertView.findViewById(R.id.img_Jobs_SR);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}

holder.txtitems.setText(items[pos]);
if (arrows[pos] > 0)
{
holder.img.setImageResource(R.drawable.arrows_in);
}
else
{
holder.img.setImageDrawable(null);
}

return convertView;
}
}


my single row xml



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent">


<com.balysv.materialripple.MaterialRippleLayout
android:id="@+id/ripple"
android:layout_width="match_parent"
app:mrl_rippleColor="@color/yellow_ShahreHarah"
app:mrl_rippleOverlay="true"
app:mrl_rippleDimension="10dp"
app:mrl_rippleAlpha="0.2"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
app:mrl_rippleHover="true"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_height="fill_parent">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="10dp"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:src="@drawable/arrows_in"
android:id="@+id/img_Jobs_SR"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:textAppearance="?android:attr/textAppearanceListItem"
android:text="Large Text"
android:textDirection="rtl"
android:maxLines="1"
android:id="@+id/txv_Jobs_SR"
android:gravity="right"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="10dp"
android:layout_marginTop="19dp"
android:layout_marginBottom="10dp"
android:layout_toRightOf="@+id/img_Jobs_SR"
android:layout_toEndOf="@+id/img_Jobs_SR" />

</RelativeLayout>

</com.balysv.materialripple.MaterialRippleLayout>




and this is my main xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="match_parent">

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:background="@color/yellow_ShahreHarah"
android:id="@+id/lil_Jobs_Top"
android:layout_height="50dp">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:src="@drawable/arrows_in"
android:id="@+id/img_Jobs_Top" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textDirection="rtl"
android:textSize="20sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="گروه های شغلی"
android:id="@+id/textView2" />
</RelativeLayout>

</LinearLayout>

<View
android:layout_width="fill_parent"
android:layout_height="4dp"
android:background="@drawable/shadow_left"
android:layout_alignParentTop="true"/>

<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:clickable="true"
android:id="@+id/lstv_Jobs" />




****************answer*****
i found answer



in single row xml file you have to write like this



<com.balysv.materialripple.MaterialRippleLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables"
app:mrl_rippleColor="#5b9bd5"
app:mrl_rippleOverlay="true"
app:mrl_rippleDimension="10dp"
app:mrl_rippleAlpha="0.2"
app:mrl_rippleHover="true"
app:mrl_rippleDelayClick="true"
android:background="#00deeaf6"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/lil_PIP_SR"
android:background="#00deeaf6"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<RelativeLayout
android:layout_weight="1"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:layout_width="10dp"
android:layout_height="wrap_content">

<ImageView
android:layout_width="30dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/phone_home"
android:id="@+id/img_PIP_HM_sr"
android:layout_height="30dp" />
</RelativeLayout>
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>









share|improve this question





























    2















    I import this library to my android project. 'com.balysv:material-ripple:1.0.1'
    and I want to use in listview. ripple works fine but when I touch listview setinotemclicklistener not working. this is my code.



    public class Jobs extends Activity {

    ListView listOfJobs;
    LinearLayout llBack;
    //boolean bolSubGroup = {false,false,false,true,false,true,false,true,true,false,false,false,true};
    ArrayList<String> lstID = new ArrayList<String>();
    ArrayList<String> lstTitle = new ArrayList<String>();
    ArrayList<Integer> lstSubggroup = new ArrayList<Integer>();
    String strTitle;
    Integer intSubgroup ;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.jobs);
    ListJobs();
    strTitle = new String[lstTitle.size()];
    intSubgroup = new Integer[lstSubggroup.size()];


    lstTitle.toArray(strTitle);
    lstSubggroup.toArray(intSubgroup);
    listOfJobs = (ListView) findViewById(R.id.lstv_Jobs);
    LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(Jobs.this,
    R.animator.in_from_right2), 0.8f); //0.5f == time between appearance of listview item
    listOfJobs.setLayoutAnimation(lac);
    listOfJobs.setAdapter(new JobsAdapter1(this, R.layout.jobs_single_row,
    R.id.txv_Jobs_SR, R.id.img_Jobs_SR, strTitle, intSubgroup));
    listOfJobs.setOnItemClickListener(this);

    llBack = (LinearLayout) findViewById(R.id.lil_Jobs_Top);
    llBack.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    vibe.vibrate(20);
    finish();
    }
    });






    listOfJobs.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

    });//*/
    }


    my array adapter



    class JobsAdapter1 extends ArrayAdapter  {
    Activity context;
    String items;
    Integer arrows;
    int layoutId;
    int textId;
    int imageId;

    JobsAdapter1(Activity context, int layoutId, int textId, int imageId, String items, Integer arrows)
    {
    super(context, layoutId, items);

    this.context = context;
    this.items = items;
    this.arrows = arrows;
    this.layoutId = layoutId;
    this.textId = textId;
    this.imageId = imageId;

    }

    private class ViewHolder {
    TextView txtitems;
    ImageView img;
    }

    public View getView(int pos, View convertView, ViewGroup parent)
    {


    LayoutInflater inflater = context.getLayoutInflater();
    ViewHolder holder = null;
    if (convertView == null) {
    convertView = inflater.inflate(R.layout.jobs_single_row, null);
    holder = new ViewHolder();
    holder.txtitems = (TextView) convertView.findViewById(R.id.txv_Jobs_SR);
    holder.img = (ImageView) convertView.findViewById(R.id.img_Jobs_SR);
    convertView.setTag(holder);
    }
    else
    {
    holder = (ViewHolder) convertView.getTag();
    }

    holder.txtitems.setText(items[pos]);
    if (arrows[pos] > 0)
    {
    holder.img.setImageResource(R.drawable.arrows_in);
    }
    else
    {
    holder.img.setImageDrawable(null);
    }

    return convertView;
    }
    }


    my single row xml



    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <com.balysv.materialripple.MaterialRippleLayout
    android:id="@+id/ripple"
    android:layout_width="match_parent"
    app:mrl_rippleColor="@color/yellow_ShahreHarah"
    app:mrl_rippleOverlay="true"
    app:mrl_rippleDimension="10dp"
    app:mrl_rippleAlpha="0.2"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    app:mrl_rippleHover="true"
    android:layout_height="wrap_content">
    <RelativeLayout
    android:layout_width="fill_parent"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:layout_height="fill_parent">
    <ImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    android:layout_margin="10dp"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:src="@drawable/arrows_in"
    android:id="@+id/img_Jobs_SR"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:textAppearance="?android:attr/textAppearanceListItem"
    android:text="Large Text"
    android:textDirection="rtl"
    android:maxLines="1"
    android:id="@+id/txv_Jobs_SR"
    android:gravity="right"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_marginRight="10dp"
    android:layout_marginTop="19dp"
    android:layout_marginBottom="10dp"
    android:layout_toRightOf="@+id/img_Jobs_SR"
    android:layout_toEndOf="@+id/img_Jobs_SR" />

    </RelativeLayout>

    </com.balysv.materialripple.MaterialRippleLayout>




    and this is my main xml



    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:background="#ffffff"
    android:layout_height="match_parent">

    <LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:background="@color/yellow_ShahreHarah"
    android:id="@+id/lil_Jobs_Top"
    android:layout_height="50dp">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    android:src="@drawable/arrows_in"
    android:id="@+id/img_Jobs_Top" />

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="20dp"
    android:textDirection="rtl"
    android:textSize="20sp"
    android:layout_centerVertical="true"
    android:layout_alignParentRight="true"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="گروه های شغلی"
    android:id="@+id/textView2" />
    </RelativeLayout>

    </LinearLayout>

    <View
    android:layout_width="fill_parent"
    android:layout_height="4dp"
    android:background="@drawable/shadow_left"
    android:layout_alignParentTop="true"/>

    <ListView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="none"
    android:clickable="true"
    android:id="@+id/lstv_Jobs" />




    ****************answer*****
    i found answer



    in single row xml file you have to write like this



    <com.balysv.materialripple.MaterialRippleLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    tools:ignore="UseCompoundDrawables"
    app:mrl_rippleColor="#5b9bd5"
    app:mrl_rippleOverlay="true"
    app:mrl_rippleDimension="10dp"
    app:mrl_rippleAlpha="0.2"
    app:mrl_rippleHover="true"
    app:mrl_rippleDelayClick="true"
    android:background="#00deeaf6"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <LinearLayout
    android:id="@+id/lil_PIP_SR"
    android:background="#00deeaf6"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
    android:layout_weight="1"
    android:paddingTop="15dp"
    android:paddingBottom="15dp"
    android:layout_width="10dp"
    android:layout_height="wrap_content">

    <ImageView
    android:layout_width="30dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:src="@drawable/phone_home"
    android:id="@+id/img_PIP_HM_sr"
    android:layout_height="30dp" />
    </RelativeLayout>
    </LinearLayout>
    </com.balysv.materialripple.MaterialRippleLayout>









    share|improve this question



























      2












      2








      2








      I import this library to my android project. 'com.balysv:material-ripple:1.0.1'
      and I want to use in listview. ripple works fine but when I touch listview setinotemclicklistener not working. this is my code.



      public class Jobs extends Activity {

      ListView listOfJobs;
      LinearLayout llBack;
      //boolean bolSubGroup = {false,false,false,true,false,true,false,true,true,false,false,false,true};
      ArrayList<String> lstID = new ArrayList<String>();
      ArrayList<String> lstTitle = new ArrayList<String>();
      ArrayList<Integer> lstSubggroup = new ArrayList<Integer>();
      String strTitle;
      Integer intSubgroup ;


      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      setContentView(R.layout.jobs);
      ListJobs();
      strTitle = new String[lstTitle.size()];
      intSubgroup = new Integer[lstSubggroup.size()];


      lstTitle.toArray(strTitle);
      lstSubggroup.toArray(intSubgroup);
      listOfJobs = (ListView) findViewById(R.id.lstv_Jobs);
      LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(Jobs.this,
      R.animator.in_from_right2), 0.8f); //0.5f == time between appearance of listview item
      listOfJobs.setLayoutAnimation(lac);
      listOfJobs.setAdapter(new JobsAdapter1(this, R.layout.jobs_single_row,
      R.id.txv_Jobs_SR, R.id.img_Jobs_SR, strTitle, intSubgroup));
      listOfJobs.setOnItemClickListener(this);

      llBack = (LinearLayout) findViewById(R.id.lil_Jobs_Top);
      llBack.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
      vibe.vibrate(20);
      finish();
      }
      });






      listOfJobs.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

      });//*/
      }


      my array adapter



      class JobsAdapter1 extends ArrayAdapter  {
      Activity context;
      String items;
      Integer arrows;
      int layoutId;
      int textId;
      int imageId;

      JobsAdapter1(Activity context, int layoutId, int textId, int imageId, String items, Integer arrows)
      {
      super(context, layoutId, items);

      this.context = context;
      this.items = items;
      this.arrows = arrows;
      this.layoutId = layoutId;
      this.textId = textId;
      this.imageId = imageId;

      }

      private class ViewHolder {
      TextView txtitems;
      ImageView img;
      }

      public View getView(int pos, View convertView, ViewGroup parent)
      {


      LayoutInflater inflater = context.getLayoutInflater();
      ViewHolder holder = null;
      if (convertView == null) {
      convertView = inflater.inflate(R.layout.jobs_single_row, null);
      holder = new ViewHolder();
      holder.txtitems = (TextView) convertView.findViewById(R.id.txv_Jobs_SR);
      holder.img = (ImageView) convertView.findViewById(R.id.img_Jobs_SR);
      convertView.setTag(holder);
      }
      else
      {
      holder = (ViewHolder) convertView.getTag();
      }

      holder.txtitems.setText(items[pos]);
      if (arrows[pos] > 0)
      {
      holder.img.setImageResource(R.drawable.arrows_in);
      }
      else
      {
      holder.img.setImageDrawable(null);
      }

      return convertView;
      }
      }


      my single row xml



      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_width="match_parent"
      android:layout_height="match_parent">


      <com.balysv.materialripple.MaterialRippleLayout
      android:id="@+id/ripple"
      android:layout_width="match_parent"
      app:mrl_rippleColor="@color/yellow_ShahreHarah"
      app:mrl_rippleOverlay="true"
      app:mrl_rippleDimension="10dp"
      app:mrl_rippleAlpha="0.2"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      app:mrl_rippleHover="true"
      android:layout_height="wrap_content">
      <RelativeLayout
      android:layout_width="fill_parent"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_height="fill_parent">
      <ImageView
      android:layout_width="36dp"
      android:layout_height="36dp"
      android:layout_margin="10dp"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:src="@drawable/arrows_in"
      android:id="@+id/img_Jobs_SR"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" />

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:textAppearance="?android:attr/textAppearanceListItem"
      android:text="Large Text"
      android:textDirection="rtl"
      android:maxLines="1"
      android:id="@+id/txv_Jobs_SR"
      android:gravity="right"
      android:layout_alignParentTop="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:layout_marginRight="10dp"
      android:layout_marginTop="19dp"
      android:layout_marginBottom="10dp"
      android:layout_toRightOf="@+id/img_Jobs_SR"
      android:layout_toEndOf="@+id/img_Jobs_SR" />

      </RelativeLayout>

      </com.balysv.materialripple.MaterialRippleLayout>




      and this is my main xml



      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:background="#ffffff"
      android:layout_height="match_parent">

      <LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:background="@color/yellow_ShahreHarah"
      android:id="@+id/lil_Jobs_Top"
      android:layout_height="50dp">

      <RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent">
      <ImageView
      android:layout_width="25dp"
      android:layout_height="25dp"
      android:layout_centerVertical="true"
      android:layout_alignParentLeft="true"
      android:src="@drawable/arrows_in"
      android:id="@+id/img_Jobs_Top" />

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="20dp"
      android:textDirection="rtl"
      android:textSize="20sp"
      android:layout_centerVertical="true"
      android:layout_alignParentRight="true"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="گروه های شغلی"
      android:id="@+id/textView2" />
      </RelativeLayout>

      </LinearLayout>

      <View
      android:layout_width="fill_parent"
      android:layout_height="4dp"
      android:background="@drawable/shadow_left"
      android:layout_alignParentTop="true"/>

      <ListView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:scrollbars="none"
      android:clickable="true"
      android:id="@+id/lstv_Jobs" />




      ****************answer*****
      i found answer



      in single row xml file you have to write like this



      <com.balysv.materialripple.MaterialRippleLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      tools:ignore="UseCompoundDrawables"
      app:mrl_rippleColor="#5b9bd5"
      app:mrl_rippleOverlay="true"
      app:mrl_rippleDimension="10dp"
      app:mrl_rippleAlpha="0.2"
      app:mrl_rippleHover="true"
      app:mrl_rippleDelayClick="true"
      android:background="#00deeaf6"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">
      <LinearLayout
      android:id="@+id/lil_PIP_SR"
      android:background="#00deeaf6"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">

      <RelativeLayout
      android:layout_weight="1"
      android:paddingTop="15dp"
      android:paddingBottom="15dp"
      android:layout_width="10dp"
      android:layout_height="wrap_content">

      <ImageView
      android:layout_width="30dp"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:src="@drawable/phone_home"
      android:id="@+id/img_PIP_HM_sr"
      android:layout_height="30dp" />
      </RelativeLayout>
      </LinearLayout>
      </com.balysv.materialripple.MaterialRippleLayout>









      share|improve this question
















      I import this library to my android project. 'com.balysv:material-ripple:1.0.1'
      and I want to use in listview. ripple works fine but when I touch listview setinotemclicklistener not working. this is my code.



      public class Jobs extends Activity {

      ListView listOfJobs;
      LinearLayout llBack;
      //boolean bolSubGroup = {false,false,false,true,false,true,false,true,true,false,false,false,true};
      ArrayList<String> lstID = new ArrayList<String>();
      ArrayList<String> lstTitle = new ArrayList<String>();
      ArrayList<Integer> lstSubggroup = new ArrayList<Integer>();
      String strTitle;
      Integer intSubgroup ;


      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      setContentView(R.layout.jobs);
      ListJobs();
      strTitle = new String[lstTitle.size()];
      intSubgroup = new Integer[lstSubggroup.size()];


      lstTitle.toArray(strTitle);
      lstSubggroup.toArray(intSubgroup);
      listOfJobs = (ListView) findViewById(R.id.lstv_Jobs);
      LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(Jobs.this,
      R.animator.in_from_right2), 0.8f); //0.5f == time between appearance of listview item
      listOfJobs.setLayoutAnimation(lac);
      listOfJobs.setAdapter(new JobsAdapter1(this, R.layout.jobs_single_row,
      R.id.txv_Jobs_SR, R.id.img_Jobs_SR, strTitle, intSubgroup));
      listOfJobs.setOnItemClickListener(this);

      llBack = (LinearLayout) findViewById(R.id.lil_Jobs_Top);
      llBack.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
      vibe.vibrate(20);
      finish();
      }
      });






      listOfJobs.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

      });//*/
      }


      my array adapter



      class JobsAdapter1 extends ArrayAdapter  {
      Activity context;
      String items;
      Integer arrows;
      int layoutId;
      int textId;
      int imageId;

      JobsAdapter1(Activity context, int layoutId, int textId, int imageId, String items, Integer arrows)
      {
      super(context, layoutId, items);

      this.context = context;
      this.items = items;
      this.arrows = arrows;
      this.layoutId = layoutId;
      this.textId = textId;
      this.imageId = imageId;

      }

      private class ViewHolder {
      TextView txtitems;
      ImageView img;
      }

      public View getView(int pos, View convertView, ViewGroup parent)
      {


      LayoutInflater inflater = context.getLayoutInflater();
      ViewHolder holder = null;
      if (convertView == null) {
      convertView = inflater.inflate(R.layout.jobs_single_row, null);
      holder = new ViewHolder();
      holder.txtitems = (TextView) convertView.findViewById(R.id.txv_Jobs_SR);
      holder.img = (ImageView) convertView.findViewById(R.id.img_Jobs_SR);
      convertView.setTag(holder);
      }
      else
      {
      holder = (ViewHolder) convertView.getTag();
      }

      holder.txtitems.setText(items[pos]);
      if (arrows[pos] > 0)
      {
      holder.img.setImageResource(R.drawable.arrows_in);
      }
      else
      {
      holder.img.setImageDrawable(null);
      }

      return convertView;
      }
      }


      my single row xml



      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_width="match_parent"
      android:layout_height="match_parent">


      <com.balysv.materialripple.MaterialRippleLayout
      android:id="@+id/ripple"
      android:layout_width="match_parent"
      app:mrl_rippleColor="@color/yellow_ShahreHarah"
      app:mrl_rippleOverlay="true"
      app:mrl_rippleDimension="10dp"
      app:mrl_rippleAlpha="0.2"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      app:mrl_rippleHover="true"
      android:layout_height="wrap_content">
      <RelativeLayout
      android:layout_width="fill_parent"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_height="fill_parent">
      <ImageView
      android:layout_width="36dp"
      android:layout_height="36dp"
      android:layout_margin="10dp"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:src="@drawable/arrows_in"
      android:id="@+id/img_Jobs_SR"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" />

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:textAppearance="?android:attr/textAppearanceListItem"
      android:text="Large Text"
      android:textDirection="rtl"
      android:maxLines="1"
      android:id="@+id/txv_Jobs_SR"
      android:gravity="right"
      android:layout_alignParentTop="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:layout_marginRight="10dp"
      android:layout_marginTop="19dp"
      android:layout_marginBottom="10dp"
      android:layout_toRightOf="@+id/img_Jobs_SR"
      android:layout_toEndOf="@+id/img_Jobs_SR" />

      </RelativeLayout>

      </com.balysv.materialripple.MaterialRippleLayout>




      and this is my main xml



      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:background="#ffffff"
      android:layout_height="match_parent">

      <LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:background="@color/yellow_ShahreHarah"
      android:id="@+id/lil_Jobs_Top"
      android:layout_height="50dp">

      <RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent">
      <ImageView
      android:layout_width="25dp"
      android:layout_height="25dp"
      android:layout_centerVertical="true"
      android:layout_alignParentLeft="true"
      android:src="@drawable/arrows_in"
      android:id="@+id/img_Jobs_Top" />

      <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="20dp"
      android:textDirection="rtl"
      android:textSize="20sp"
      android:layout_centerVertical="true"
      android:layout_alignParentRight="true"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="گروه های شغلی"
      android:id="@+id/textView2" />
      </RelativeLayout>

      </LinearLayout>

      <View
      android:layout_width="fill_parent"
      android:layout_height="4dp"
      android:background="@drawable/shadow_left"
      android:layout_alignParentTop="true"/>

      <ListView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:scrollbars="none"
      android:clickable="true"
      android:id="@+id/lstv_Jobs" />




      ****************answer*****
      i found answer



      in single row xml file you have to write like this



      <com.balysv.materialripple.MaterialRippleLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      tools:ignore="UseCompoundDrawables"
      app:mrl_rippleColor="#5b9bd5"
      app:mrl_rippleOverlay="true"
      app:mrl_rippleDimension="10dp"
      app:mrl_rippleAlpha="0.2"
      app:mrl_rippleHover="true"
      app:mrl_rippleDelayClick="true"
      android:background="#00deeaf6"
      android:descendantFocusability="blocksDescendants"
      android:focusable="false"
      android:focusableInTouchMode="false"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">
      <LinearLayout
      android:id="@+id/lil_PIP_SR"
      android:background="#00deeaf6"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">

      <RelativeLayout
      android:layout_weight="1"
      android:paddingTop="15dp"
      android:paddingBottom="15dp"
      android:layout_width="10dp"
      android:layout_height="wrap_content">

      <ImageView
      android:layout_width="30dp"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:src="@drawable/phone_home"
      android:id="@+id/img_PIP_HM_sr"
      android:layout_height="30dp" />
      </RelativeLayout>
      </LinearLayout>
      </com.balysv.materialripple.MaterialRippleLayout>






      layout android-arrayadapter material ripple






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '15 at 8:02







      Hojjat Mehri

















      asked Apr 28 '15 at 12:13









      Hojjat MehriHojjat Mehri

      799




      799
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Try set app:mrl_rippleInAdapter="true" in your com.balysv.materialripple.MaterialRippleLayout. It works for me.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29919171%2fandroid-material-ripple-layout-arrayadapter-setonitemclicklistener-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Try set app:mrl_rippleInAdapter="true" in your com.balysv.materialripple.MaterialRippleLayout. It works for me.






            share|improve this answer




























              1














              Try set app:mrl_rippleInAdapter="true" in your com.balysv.materialripple.MaterialRippleLayout. It works for me.






              share|improve this answer


























                1












                1








                1







                Try set app:mrl_rippleInAdapter="true" in your com.balysv.materialripple.MaterialRippleLayout. It works for me.






                share|improve this answer













                Try set app:mrl_rippleInAdapter="true" in your com.balysv.materialripple.MaterialRippleLayout. It works for me.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 11:18









                HeavenHeaven

                25127




                25127






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29919171%2fandroid-material-ripple-layout-arrayadapter-setonitemclicklistener-not-working%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine