java - using android layout and android id -


view v=inflater.inflate(r.layout.fragment_b,container,false); view v = findviewbyid(r.id.fragb);  

i want know when use

r.id.fragb 

and when use

r.layout.fragment_b. 

can't use

r.id.fragb  

in place of

r.layout.fragment_b  

in first statement.

all references under r.layout refer layout files themselves. example, if define layout fragment in fragment_b.xml, r.layout.fragment_b way framework reference file.

references under r.id identifiers. identifiers views in layout, or generic identifiers create other purposes.

your layout xml might start root view has id, might not. layout xml can contain views many different ids. 2 not interchangeable.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - href attribute breaking an element -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -