Reputation: 1895
I did some research on this topic but could not find my answer.
I am making a news app using RecyclerView and CardView.
I created a layout XML file named "list_row" that includes the CardView. I want to see the preview shown for this XML on my phone when I build it.
activity_main
currently only has a progress bar but when I build, this is the XML that gets loaded.
Any help on this would be very appreciated!
Upvotes: 0
Views: 99
Reputation: 216
Just change the layout id passed on setContentView() inside onCreate() method of MainActivity.
Upvotes: 0
Reputation: 6495
You can change the layout in the java code.
R.layout.activity_main
in the onEnable
method. R.layout.list_row
Upvotes: 1
Reputation: 4182
You can add this line in your RecyclerView
:
tools:listitem="@layout/list_row"
It will show many layouts in your Preview
mode
Upvotes: 0