Blnpwr
Blnpwr

Reputation: 1875

Android Studio XML using marginRight with API 17

I have a RelativeLayout and I am using android:layout_marginEnd="170dp" and Android Studio is telling me:

To support older version than API 17(project specifies 15) you should also add

android:layout_marginRight="170dp"

It's not an error, it compiles correctly, but I don't understand this hint. Why should I use marginRight? Why not marginLeft? Can anyone explain me the secret behind this? I looked for other answers but I still didn't get it.

Thank you in advance.

Upvotes: 2

Views: 643

Answers (1)

Sean Barbeau
Sean Barbeau

Reputation: 11756

android:layout_marginEnd was added in API 17 for better support for right-to-left languages. However, earlier versions of Android prior to API 17 don't recognize this tag, so your need to add android:layout_marginRight as well.

Upvotes: 3

Related Questions