TheEllo
TheEllo

Reputation: 39

Skipping Android Layouts xml resource

When developing for the android. Are we bound to using xml layout files? (In res\layout ) Or can we skip them entirely and programmatically create and implement our layouts for UI?

Upvotes: 0

Views: 66

Answers (1)

0xDEADC0DE
0xDEADC0DE

Reputation: 2473

Sure you can. In an Activity you can use setContentView(View view) instead of setContentView(int resource) in the onCreate() callback. If you use a Fragment you can programmatically create a View instead of inflating a resource. This has to be done in the onCreateView() callback of the fragment

Upvotes: 1

Related Questions