Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is better way app:layout_constraintStart_toStartOf or app:layout_constraintLeft_toLeftOf

I like to know if

app:layout_constraintStart_toStartOf=""

is better than

app:layout_constraintLeft_toLeftOf=""

or Android recommend use anyone.

Thanks!

like image 904
Erick Daniel Juarez Gil Avatar asked Oct 23 '25 16:10

Erick Daniel Juarez Gil


2 Answers

Well what's your use-case?

In Android, the start dimension was added in I think Lollipop. It basically adds support for RTL languages. For much of the world, LTR is the default layout, and so start and left are the same thing.

However, there are also quite a few languages that are read RTL, such as Arabic. The point of start is to make these languages display better in your app (assuming you have translations implemented) and line up properly with the text.

If your app is only going to be used on, say, devices with the English language, left is perfectly fine for now. If you want to make a general-audience app, and support RTL languages, you should use start to avoid wonky layouts.

like image 138
TheWanderer Avatar answered Oct 26 '25 05:10

TheWanderer


It usually depends on your API version.

  • If your app API level >=17 you should use “start” and “end” instead of “left” and "right"
  • If your app API level <17 then you should add “start” and end” in addition to “left” and “right”.

The two attributes work hand in hand. But theoretically speaking, start and end are better to use first, if your API level is greater than 16. Left and Right are not necessary when the API is greater than 16.

But if the API is less than 17, then it is more advisable to use "Left" and "Right", because they can function completely without any additional the "Start" and "End".


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!