Kritias
Kritias

Reputation: 187

How to put the right border of a View onto horizontal center?

In my Android app, I am using a RelativeLayout to custom one of my Activitys. I have a square ImageView that I want to set precisely. In other words, I want its right border to touch the horizontal center of the layout.

Is such a thing possible without doing weird things such as centering and then marging?

Upvotes: 1

Views: 35

Answers (1)

MichaelAndroidNewbie
MichaelAndroidNewbie

Reputation: 705

It's not a perfect solution but potentially you could use: android:layout_marginRight="xdp" Where x is half of your screen width + half the width of your imageView? I know it's not perfect but might help until some guru comes along

Upvotes: 2

Related Questions