Consider adding android:paddingStart="25dp" to better support right-to-left layouts Error

12,471

Solution 1

android:paddingStart is newly introduced tag in android 4.2 onwards.

Now RTL means right-to-left layouts which are used in RTL languages like arabic.

So while developing layout you can add same value to paddingStart as padding left. So that when android render RTL layout it will consider paddingStart.

  • 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.

Ref Links: RTL Layout Support

Developer Blog: Native RTL support in Android 4.2

Solution 2

If you want to change the severity of that error go to "Lint Error Checking" at Preferences and change "RtlSymmetry" to "Warning" instead "Error".

Solution 3

Just add android:paddingRight="0dp" along with android:paddingLeft="25dp", error will disappear.

Solution 4

Answer from sreenu solved my issue. But if you target higher APIs you should also add paddingEnd, as in the following example:

android:paddingLeft="25dp"
android:paddingStart="25dp"
android:paddingRight="0dp"
android:paddingEnd="0dp"
Share:
12,471
Anand.B
Author by

Anand.B

Android enthusiast!!

Updated on July 27, 2022

Comments

  • Anand.B
    Anand.B almost 2 years

    I recently downloaded a new ADT. Every time after saving my projects ,it shows the following XML error. But the same goes away when I clean it. Is there a permanent solution for the same.

    Thanks in advance.

      <TextView
            android:id="@+id/selectquantityprompt"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dip"
            android:layout_marginRight="50dip"
            android:layout_marginTop="2dip"
            android:text="Select Quantity"
            android:textSize="20sp"
            android:textColor="#33b5e5"
            android:paddingLeft="25dp" //error at this line
            android:paddingTop="5dp"
            android:paddingBottom="5dp"
    
            />
    

    Multiple annotations found at this line:

    - Consider adding android:paddingStart="25dp" to better support right-to-left layouts
    - When you define %1$s you should probably also define %2$s for right-to-left 
    
    • Robin Ellerkmann
      Robin Ellerkmann almost 10 years
      Please show the xml file for this message
    • nouseforname
      nouseforname almost 10 years
      Can you try "paddingStart" instead?!
    • Sancao
      Sancao almost 10 years
      And paddingRight for RTL, which it's probably trying to tell you?
    • dum4ll3
      dum4ll3 over 9 years
      Same here. And for me it is not just warnings, but errors! So I can't compile my code without cleaning it first, to get rid of these "errors". And it annoys me, because every build after a cleaning take ages to finish!!