考虑添加android:paddingStart =“25dp”更好地支持从右到左的布局错误 [英] Consider adding android:paddingStart="25dp" to better support right-to-left layouts Error
问题描述
我最近下载了一个新的 ADT
。保存项目后每次都显示以下 XML
错误。但是当我清理它的时候也一样。是否有永久的解决方案。
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.
提前感谢。
<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"
/>
在此行找到多个注释:
- 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
推荐答案
android:paddingStart是新的在Android 4.2以上引入标签。
android:paddingStart is newly introduced tag in android 4.2 onwards.
现在,RTL表示在RTL语言(如阿拉伯语)中使用的从右到左的布局。
Now RTL means right-to-left layouts which are used in RTL languages like arabic.
因此,在开发布局时,您可以向paddingStart添加相同的值作为填充左边。所以当android渲染RTL布局时会考虑paddingStart。
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.
- 如果您将应用定位到Android 4.2(应用程序的
targetSdkVersion或minSdkVersion为17或更高版本),则应该
使用开始和结束而不是左和右。例如,
android:paddingLeft应该成为android:paddingStart。 - 如果您希望您的应用程序使用早于Android 4.2
的版本(应用程序的targetSdkVersion或minSdkVersion是16或更少),那么你
应该添加开始和结束除了左和右。对于
示例,您将使用android:paddingLeft和android:paddingStart。
参考链接:版本支持
开发者博客:Android 4.2中的Native RTL支持
这篇关于考虑添加android:paddingStart =“25dp”更好地支持从右到左的布局错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!