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 time but I still want to be able to position them relative to eachother. Any suggestions?
A:
Implement your RelativeLayout.LayoutParams
rules in Java and apply them after "adding [your] XML files at run time".
CommonsWare
2010-04-15 01:48:54
I don't really know how to do whatever you're suggesting. This is my code for adding the view...View newView = mInflater.inflate(layoutId, mRokonInterfaceView, true);mInterfaceComponents.put(id, mActivity.findViewById(id));What would I do to position it at this point?
Joren
2010-04-15 02:07:50
A:
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.
Joren
2010-04-15 02:50:03