Debarshi Roy
Debarshi Roy

Reputation: 3

setting distance between 2 views in android app

I am using Relative Layout and would like to set the distance between 2 views (An ImageView and an Button). Whatever I could research and see, is that the only relative directions can be set between 2 views and not distance. The distance can be set only between the vieance betw and parent layout. Is there a way, I can set the distween 2 views ?

Upvotes: 0

Views: 1092

Answers (1)

Kevin Coppock
Kevin Coppock

Reputation: 134684

Just use margins. For example if you have two views side by side:

[ V1 ][ V2 ]

and you want:

[ V1 ]    [ V2 ]

Just set android:layout_marginRight="x" on V1, where x is the distance.

Upvotes: 2

Related Questions