Get gravity of View programmatically

Viewed 22

I have some views in my app and I want to check what gravity do they have (as a View class). Tried the implementation below but it gives me strange numbers like 8388659. I can't really understand what they are (center, right or back) and don't know how I can get gravities like that.

View editView;
...
if(Gravity.LEFT == editView.getForegroundGravity())
    mLeftGravityIv.setBackgroundColor(Color.GRAY);
else if(Gravity.CENTER == editView.getForegroundGravity())
    mCenterGravityIv.setBackgroundColor(Color.GRAY);
else
    mRightGravityIv.setBackgroundColor(Color.GRAY);

Can I somehow get a View gravity as Gravity.Center, Gravity.Right and Gravity.Left?

0 Answers
Related