remove rule from RelativeLayout before api 17
AndroidAndroid LayoutAndroid RelativelayoutAndroid Problem Overview
Prior to API 17, how do I remove a rule from a layout? I have a RelativeLayout with a number of children. The RelativeLayout is the main layout of my activity. After adding the rule programmatically using
RelativeLayout.LayoutParams layout = (LayoutParams) theChild.getLayoutParams();
layout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
I need to remove the rule programmatically at some later time. How would I do this assuming earlier API than 17?
Android Solutions
Solution 1 - Android
Ah, I figure it out.
RelativeLayout.LayoutParams layout = (LayoutParams) myChild.getLayoutParams();
layout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
So there is really no removeRule until API 17.
Solution 2 - Android
Depending on the situation, in my case I created new LayoutParams
and then added rules which were needed