Is there any way to Create a card on a click of a button Android?
then when I click the add button it will generate another card similar to the first one
Is there any way to Create a card on a click of a button Android?
then when I click the add button it will generate another card similar to the first one
You can use A RecyclerView
with RecyclerView.Adapter
and some sort of List
of elements.
When you want to create a new card, simply add an element to the end of your list and call notifyItemInserted(position)
.
Some reference
Also, you can use a vertical LinearLayout
to hold your views and Create a xml file to represent your cards. Every time you want to add a new view, inflate the xml file and type layout.addView(view)
It will be more complicate to manage your cards, but if you plan only to add new cards it may be simpler than a recyclerview.
Example
These are the best ways i know to achieve what you asked.