Skip to content
Related Articles

Related Articles

How to add Bullet list in a RecyclerView in Android?

View Discussion
Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 16 Apr, 2020

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:-

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

        implementation 'androidx.recyclerview:recyclerview:1.1.0'

  2. Create a bullet.xml file in the drawable folder.

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

  3. In activity_main.xml, add the following code.

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

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

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

  5. 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(;

  6. 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",
                "Dijkastra’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));


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!