Open In App
Related Articles

How to add Bullet list in a RecyclerView in Android?

Improve Article
Save Article
Like Article

Recycler View allows us to show a list of items but to convert our list into the bulleted list we have to do some extra work. You can do this task by following these simple steps given below:-

Add the support Library in build.gradle file for Recycler View in the dependencies section. 


    implementation 'androidx.recyclerview:recyclerview:1.1.0'

Create a bullet.xml file in the drawable folder


<?xml version="1.0" encoding="utf-8"?>

In activity_main.xml, add the following code. 


<?xml version="1.0" encoding="utf-8"?>

Create a new custom_layout.xml file with the following code. 


<?xml version="1.0" encoding="utf-8"?>

Create a class and add the following code. 


public class MyAdapter
    extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
    String text[];
    Activity activity;
    public MyAdapter(Activity activity,
                     String text[])
        this.activity = activity;
        this.text = text;
    // This method is used to attach
    // custom layout to the recycler view
    public MyViewHolder onCreateViewHolder(
        @NonNull ViewGroup parent,
        int viewType)
        View view
            = activity.getLayoutInflater()
                      parent, false);
        return new MyViewHolder(view);
    // This method is used to set the action
    // to the widgets of our custom layout.
    public void onBindViewHolder(
        @NonNull MyViewHolder holder,
        int position)
    public int getItemCount()
        return text.length;
    class MyViewHolder extends RecyclerView.ViewHolder {
        TextView textView;
        public MyViewHolder(@NonNull View itemView)
            textView = itemView.findViewById(;

Finally, in add the following code. 


public class MainActivity
    extends AppCompatActivity {
    RecyclerView recyclerView;
    String text[]
        = { "Linear Search", "Binary Search", "Selection Sort",
            "Bubble Sort", "Insertion Sort",
            "Recursive Insertion Sort", "Merge Sort",
            "Iterative Merge Sort", "Quick Sort",
            "Heap Sort", "Counting Sort",
            "Klee’s Algorithm", "Karatsuba algorithm",
            "Dijkstra’s Shortest Path Algorithm",
            "Dial’s Algorithm",
            "Kruskal’s Minimum Spanning Tree",
            "Prim’s Minimum Spanning Tree",
            "Naive Pattern Searching",
            "KMP Algorithm", "Rabin-Karp Algorithm" };
    protected void onCreate(Bundle savedInstanceState)
        recyclerView = findViewById(;
        MyAdapter adapter = new MyAdapter(this, text);
            new LinearLayoutManager(this));


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 08 Nov, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials