Android inflated layout alignment -


i have relativelayout aligning right. if display layout setcontentview works fine if try display inflated view, it's not aligned right anymore. know if fixed?

thanks.

edit:

the xml simple, have relativelayout padding. using android:layout_gravity="top|right".

if display whole layout setcontentview(), relativelayout aligned, when try following code alignment breaks:

inflater = layoutinflater.from(mainactivity.this); view inflated = inflater.inflate(r.layout.layout, null); relativelayout layout = (relativelayout)findviewbyid(r.id.layout); layout.addview(inflated); 

i doing because want able add inflated view multiple times.

it hard see without xml when call inflate should pass root view otherwise layout parameters specify in xml layout lost.

try this, maybe?

inflater = layoutinflater.from(mainactivity.this); relativelayout layout = (relativelayout)findviewbyid(r.id.layout); view inflated = inflater.inflate(r.layout.layout, layout, false); layout.addview(inflated); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -