Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the different between drawableLeft and drawableStart in EditText?

Tags:

android

At first I thought drawableStart would auto change the icon's location when I changed system language to Arabic, which is a language written from right to left. But when I did that, nothing happened. So I guess they are the same?

like image 370
Owen Zhao Avatar asked Dec 17 '12 02:12

Owen Zhao


People also ask

What is drawablePadding?

android:drawablePadding is used for space between image and text. – Brave. Oct 17, 2014 at 8:38. 1. The issue of this code is it causes passwordToggleDrawable left padding gap become bigger since it can't specific target to left drawable only.

Which of the following is properties of TextView?

Properties of TextView in Android. android:id-ID is an attribute used to define a TextView uniquely. android: layout_height- Height is the attribute which is used to set the height of the TextView.


1 Answers

I'm not sure the answer above is correct. From my experimentation, the icon always ends up in the same place unless you change the language AND enable RTL support.

drawableStart and drawableEnd only start switching sides when you enable RTL support in API Level 17 and above.

Change all of your app's "left/right" layout properties to new "start/end" equivalents.

  • If you are targeting your app to Android 4.2 (the app's targetSdkVersion or minSdkVersion is 17 or higher), then you should
    use “start” and “end” instead of “left” and “right”. For example,
    android:paddingLeft should become android:paddingStart.

  • If you want your app to work with versions earlier than Android 4.2 (the app's targetSdkVersion or minSdkVersion is 16 or less), then you should add “start” and end” in addition to “left” and “right”. For example, you’d use both android:paddingLeft and android:paddingStart.

like image 85
Austyn Mahoney Avatar answered Sep 20 '22 12:09

Austyn Mahoney