how to identify adapter odd and even number android code example
Example: how to identify adapter odd and even number android
@Override
public void onBindViewHolder(ViewHolder holder, int position)
{
if(position % 2 == 0)
{
//holder.rootView.setBackgroundColor(Color.BLACK);
holder.rootView.setBackgroundResource(R.color.black);
}
else
{
//holder.rootView.setBackgroundColor(Color.WHITE);
holder.rootView.setBackgroundResource(R.color.white);
}
}