开发者

Pointing layout_above to an external ID?

开发者 https://www.devze.com 2022-12-26 17:30 出处:网络
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

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消