Reputation: 8645
Multiple annotations found at this line:
- Consider replacing android:paddingLeft with android:paddingStart="5dp" to better support
right-to-left layouts
- When you define paddingLeft you should probably also define paddingRight for right-to-left
symmetry
in my xml file i got this type of error why this happen any one have idea why this happen.
here is my xml file
<LinearLayout
android:id="@+id/titles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp" // here am getting that error
android:paddingTop="10dp" >
<TextView
android:id="@+id/productTitle"
style="@style/darkGreyMediumText14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3"
android:scrollHorizontally="true"
android:text="Samsung " />
/>
Upvotes: 0
Views: 7391
Reputation: 9663
You can add both android:paddingLeft="10dp"
and android:paddingStart="10dp"
with same value.So when android render RTL layout it will consider paddingStart else paddingLeft..
https://developer.android.com/about/versions/android-4.2.html#RTL
Upvotes: 1
Reputation: 2008
I follow the instruction of Mr.Vinay Wadhwa to fix the issues,But the time of implementation i got little bit confused where i have to use this,So thats why have to put this code for the clear reference.
Include this property in Parent Layout
tools:ignore="RtlSymmetry"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="RtlSymmetry" >
Upvotes: 4
Reputation: 10190
add the attribute tools:ignore="RtlSymmetry"
to remove this warning/error. This should not be an error IMO though.
Upvotes: 6
Reputation: 25028
Multiple annotations found at this line:
- Consider replacing android:paddingLeft with android:paddingStart="5dp" to better support right-to-left layouts
- When you define paddingLeft you should probably also define paddingRight for right-to- symmetry
These seem like warnings rather than errors. Warnings dont prevent your code from compiling. Rather, they show you some extra care that you need to take.
Why are you getting these?
Well, the annotations themselves have given you the answer. paddingStart
is interpreted as paddingLeft
in LTR languages and paddingRight
in RTL languages. Hard-coding the direction will lead to strange layout in different languages.
If you are sure that you are only going to support LTR languages like English and the likes, go ahead and keep it as paddingLeft
Source: What are paddingStart and paddingEnd?
Upvotes: 0