dorjeduck
dorjeduck

Reputation: 7794

LayoutInflater or View creation programmatically

Is it faster to define a View in a xml layout file and use it via LayoutInflater in the application or is it faster to define it within the program? I understand that it is "cleaner" to define the View via xml yet here I am just interested in the performance aspect. (I am writing an adapter which uses heaps of views of a very simple type)

Upvotes: 1

Views: 425

Answers (1)

vin_mobilecem
vin_mobilecem

Reputation: 157

it depends on your need if you do it programmatically it will little bit fast as it save xml parsing time but if you want a complex relative view it is better to use xml as then there would be no time saving as you have to add many lines of complex code to do so which could be done very easily through xml .

Upvotes: 1

Related Questions