我最近下载了一个新的ADT
。每次保存我的项目后,它都会显示以下内容XML
错误。但当我清理它时,同样的情况就会消失。有没有永久的解决方案。
提前致谢。
<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 以后新引入的标签。
现在,RTL 意味着从右到左的布局,用于阿拉伯语等 RTL 语言。
因此,在开发布局时,您可以向 paddingStart 添加与 padding left 相同的值。这样当android渲染RTL布局时它就会考虑paddingStart。
- 如果您将应用程序定位到 Android 4.2(应用程序的
targetSdkVersion 或 minSdkVersion 是 17 或更高),那么你应该
使用“开始”和“结束”而不是“左”和“右”。例如,
android:paddingLeft 应变为 android:paddingStart。
- 如果您希望您的应用适用于 Android 4.2 之前的版本
(应用程序的 targetSdkVersion 或 minSdkVersion 为 16 或更低),那么您
除了“左”和“右”之外,还应该添加“开始”和“结束”。为了
例如,您可以同时使用 android:paddingLeft 和 android:paddingStart。
参考链接:RTL 布局支持
开发者博客:Android 4.2 中的原生 RTL 支持
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)