how to make recyclerview in android code example

Example 1: androidx recyclerview dependency

dependencies {
    implementation "androidx.recyclerview:recyclerview:1.1.0"
    // For control over item selection of both touch and mouse driven selection
    implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"
}

Example 2: how to use mutliple layouts in recyclerview

@Override
public int getItemViewType(int position) {
        if(user_id_array.get(position).equals(user_one))
            return 1;
        else if(user_id_array.get(position).equals(user_two))
            return 2;
        else
            return 3;
}

Example 3: how to add recyclerview support in android studio

dependencies {
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

Example 4: RECYCLER VIEW

Elective Subjects Notes

Tags:

Java Example