该项目引用RTL属性,但不显式启用或禁用RTL支持 [英] The project references RTL attributes, but does not explicitly enable or disable RTL support

查看:333
本文介绍了该项目引用RTL属性,但不显式启用或禁用RTL支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse清单文件中,我收到一条警告消息。应用程序语言是土耳其语(不是从右到左)。



该项目引用RTL属性,但不显式地启用或禁用RTL支持与android:supportsRtl in清单



我无法添加 android:supportsRtl 行,因为我的最小sdk版本是9.
这个警告很重要?



谢谢

解决方案

支持RTL(=右对左语言区域),您需要通过结束替换开始的所有引用右<属性start,end,paddingStart,paddingEnd,android:layout_alignParentStart等属性都是 RTL属性:它们的含义取决于当前的语言环境。不这样做的风险是,如果有人将系统语言设置为阿拉伯语或希伯来语,那么您的布局将被镜像,即使文本仍显示在土耳其语中。



具体如果:




  • 当前的系统语言是RTL (阿拉伯语,希伯来语.. 。)

  • 而Android设备是 API 17或更高版本

  • AND android:supportsRtl 在清单中设置为 true



否则表示左。



如果您在任何布局中使用了 android:layout_gravity =start或任何开始/结束属性,则会收到此警告您尚未在清单中设置 android:supportsRtl =true



请注意,如果您的最小SDK为16或以下,而您不想支持RTL,你实际上必须选择一个警告:




  • 如果你用左边的替换开始,你会得到警告:使用开始而不是左来确保从右到左区域设置的正确行为 Id = RtlHardCoded

  • 如果您将 android:supportsRtl 设置为 false 属性supportsRtl仅用于API级别17及更高版本(当前最小为9)。 Id = UnusedAttribute

  • 否则:**该项目引用RTL属性,但不显式地启用或禁用RTL支持与android:manifestRtl在清单** Id = RtlEnabled



如果您不支持RTL,设置 RtlHardCoded to Info而不是警告。



更多信息:



http://android-developers.blogspot.co.il/2013/03/native-rtl-support-in-android-42.html?utm_source=feedburner&utm_medium=feed&utm_campaign= Feed:+ blogspot / hsDu +(Android + Developers + Blog)



http://developer.android.com/guide/ topics / manifest / application-element.html#supportsrtl


In Eclipse manifest file , i get a warning message. Application language is Turkish ( Not right to left ).

"The project references RTL attributes, but does not explicitly enable or disable RTL support with android:supportsRtl in the manifest "

I can not add android:supportsRtl line, because my min sdk versionn is 9. This warning is important?

Thanks

解决方案

If you do not support RTL (= Right To Left locales), you need to replace all references of start by left and end by right in your xml layouts.

The attributes "start", "end", "paddingStart", "paddingEnd", "android:layout_alignParentStart" etc.. are "RTL attributes" : their meaning depends on the current locale. The risk of not doing this is that if someone sets their system language to Arabic or Hebrew your layouts will be mirrored, even if the text is still displayed in Turkish.

Specifically "start" means "right" if:

  • the current system language is RTL (Arabic, Hebrew...)
  • AND the android device is API 17 or higher
  • AND android:supportsRtl is set to true in the manifest

Otherwise is means "left".

So you get this warning if you have used android:layout_gravity="start" or any start/end attribute in any of your layout and you have not set android:supportsRtl="true" in the manifest.

Note that, if your min SDK is 16 or below and you do not want to support RTL, you actually have to choose one of the warning:

  • if you do replace start with left you will get the warning :Use "start" instead of "left" to ensure correct behavior in right-to-left locales Id=RtlHardCoded
  • if you set android:supportsRtl to false: Attribute "supportsRtl" is only used in API level 17 and higher (current min is 9). Id=UnusedAttribute
  • otherwise: ** The project references RTL attributes, but does not explicitly enable or disable RTL support with android:supportsRtl in the manifest** Id=RtlEnabled

If you do not support RTL, it seems logical to set RtlHardCoded to Info instead of warning.

More info:

http://android-developers.blogspot.co.il/2013/03/native-rtl-support-in-android-42.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+blogspot/hsDu+(Android+Developers+Blog)

http://developer.android.com/guide/topics/manifest/application-element.html#supportsrtl

这篇关于该项目引用RTL属性,但不显式启用或禁用RTL支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆