Reputation: 20223
I have a ImageView in my relative layout. How can I get all the parametres of this ImageView: not the x and y but I need all the parametres from this view: like CenterHorizontal = true etc...
Upvotes: 1
Views: 2430
Reputation: 7849
To get the rules (i.e parameter) use RelativeLayout.LayoutParams
.
So you need to get the LayoutParams
from the View
.
To get all rules, use getRules()
in RelativeLayout.LayoutParams
.
The array of point to RelativeLayout
constant by index.
For example:
RelativeLayout.ALIGN_LEFT
contain ID of the View align leftRelativeLayout.CENTER_HORIZONTAL
contain RelativeLayout.TRUE
if it is set.Upvotes: 7
Reputation: 427
you can use int[] RelativeLayout.LayoutParams.getRules()
defined here http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html#getRules().
Take the rules, parse it and get the value.
Upvotes: 2