RecyclerView onClick
RecyclerView onClick
RecyclerView onClick
Yes, it’s possible. Just implement getItemViewType(), and take care of the viewType parameter in onCreateViewHolder(). So you do something like: public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { class ViewHolder0 extends RecyclerView.ViewHolder { … public ViewHolder0(View itemView){ … } } class ViewHolder2 extends RecyclerView.ViewHolder { … public ViewHolder2(View itemView){ … } @Override public int getItemViewType(int position) { … Read more
You should use NestedScrollView instead of ScrollView when you’re trying to scroll another view in your parent layout. It’s very similar to ScrollView and part of the v4 support lib: https://developer.android.com/reference/android/support/v4/widget/NestedScrollView.html
Try this in onBindViewHolder method: if (position==2)// position which you want to disable { holder.textView.setOnClickListener(null) }else { holder.textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // perform action here } }); }
For listview you will need something like this, after populating your list: private void changeSizes() { View v; View v1; TextView tv; // this one depends on your layout TextView tv1; int count = myList.getCount(); int middleRowIndex = (int)count/2 ; TextView midRow = myList.getAdapter().getView(middleRowIndex, null, null).findViewById(R.id.textView); midRow.setTextSize(TypedValue.COMPLEX_UNIT_SP,(int)(count * middleRowIndex)); int prevIndex = middleRowIndex – 1; … Read more
Create your List reference with initialization as follows List list = new ArrayList(); if you want to update existing use the following list.clear(); list.addAll(newList); Thats it. if not fixed post your code first.