Write a program that shows the creation of reusable user interface that includes the layout.



Write a program that shows the creation of reusable user interface that includes the layout...

Answer / Sakshi Bhardwaj

"Here's an example using RecyclerView and CardView:

1. Define custom ViewHolder for your list items in a separate class, extending RecyclerView.ViewHolder.
2. Implement a ListAdapter for your data source and extend RecyclerView.Adapter.
3. In the onCreateViewHolder method, inflate the layout you want to reuse, and return the ViewHolder instance.
4. Override onBindViewHolder method to populate the UI elements in each list item with data from the data source.
5. Create a RecyclerView in your activity's layout and set the adapter for it using setAdapter(MyListAdapter).
6. Set the layout manager by calling RecyclerView.setLayoutManager(new LinearLayoutManager(context))."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Android OS Interview Questions

What is Adapter?

1 Answers  


How many dialog boxes do support in android?

1 Answers  


Which file is entry point for sencha touch app?

1 Answers  


What does adb stand for?

1 Answers  


What is so special about android?

1 Answers  


What items are important in every android project?

1 Answers  


How do I update google play services on android?

1 Answers  


What is a layout resource?

1 Answers  


Define and explain android framework.

1 Answers  


what is the difference between this and getapplicationcontext in android?

1 Answers  


Choose right kind of layouts supported in sencha touch?

1 Answers  


What is colorstatelist?

1 Answers  


Categories