show id with recyclerview code example

Example 1: how set index postion in recycler view item

//like this
  1.question
  2.question
  3.
  4.


holder.tvQuestion_no.setText(holder.getAdapterPosition()+1 +".");

Example 2: only one item in recyclerview

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:gravity="center">

        <TextView
            android:id="@+id/daystxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MON"
            android:textSize="20sp"/>

    </RelativeLayout>


</LinearLayout>

Tags:

Misc Example