DanFC
DanFC

Reputation: 258

activity and fragment layouts in android studio

just a quick question because I feel a bit confused by this:

I have both fragment_main.xml AND activity_main.xml created by android studio. By using the Graphical layout, I can drag and drop buttons and what not in both fragment and activity. The difference is, fragment lets me move stuff around freely, while activity_main doesn't.

Why is that? Is activity_main locked or something?

Also, should I leave the activity_main.xml blank and just work on fragments?

Thank you!

Upvotes: 4

Views: 362

Answers (1)

mcd
mcd

Reputation: 1432

there is no difference between fragment and activity layout they inflate whatever layout xml file which you are created. according to your explanation i think your activity layout contain linear layout so you view can be organize in vertical or horizontal form. use instead of relative layout in which you can the positions of the children in relation to each other or to the parent. for more info click this link

Upvotes: 1

Related Questions