How can I check if my view is aligned to it's parent bottom (or top).
If the view is aligned to the parent bottom, I want to align it to the parent top, and vice versa. I am able to align the view as I want but I don't know how to check it first.
My XML:
< RelativeLayout
android:layout_width="20dp"
android:layout_height="200dp">
< Button
android:id="@+id/mybutton"
android:layout_height="25dp"
android:layout_alignParentBottom="true"
android:layout_width="match_parent">
< / Button>
< / RelativeLayout >
My code:
Button mybutton = (Button) findViewById(R.id.mybutton);
LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 25);
params1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
params1.addRule(RelativeLayout.ALIGN_PARENT_TOP);
button.setLayoutParams(params1);
I can't use getRule() since that is only valid for API23 and above, and I'm using since API16.
Any help on what I can do to find this? Thanks.