Pointing layout_above to an external ID?
When I try to use layout_above to position a view above another view, it can't find the ID if it's not in the same XML file. I'm adding my XML files at run tim开发者_如何学Ce but I still want to be able to position them relative to eachother. Any suggestions?
Ok I figured out how to do what you suggested. This works:
LayoutParams lv = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
lv.addRule(RelativeLayout.ABOVE, R.id.summary_popup);
InterfaceManager.get(InterfaceManager.DONE_CANCEL_BUTTONS).setLayoutParams(lv);
Thanks for pointing me in the right direction. I only wish I could use normal XML attributes.
Implement your RelativeLayout.LayoutParams
rules in Java and apply them after "adding [your] XML files at run time".
精彩评论