安卓 warning(二)

ImageView的contentDescription

Missing contentDescription attribute on image less... (Ctrl+F1)
Non-textual widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface. Note that elements in application screens that are purely decorative and do not provide any content or enable a user action should not have accessibility content descriptions. In this case, just suppress the lint warning with a tools:ignore="ContentDescription" attribute. Note that for text fields, you should not set both the hint and the contentDescription attributes since the hint will never be shown. Just set the hint. See http://developer.android.com/guide/topics/ui/accessibility/checklist.html#special-cases.

大概可以从中读出warning的意思

  • 对于那些具有功能性的图片,对于有些盲人或者色弱等人,安卓中的辅助功能,talkback会借助contentDescription的内容对该人群进行帮助
  • 对于那些春装饰性的图片,只需要使用tools:ignore="ContentDescription" 或者将description设置为@null

marginLeft

Redundant attribute layout_marginLeft; already defining layout_marginStart with targetSdkVersion 27 less... (Ctrl+F1)
Using Gravity#LEFT and Gravity#RIGHT can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START and Gravity#END instead. Similarly, in XML gravity and layout_gravity attributes, use start rather than left. For XML attributes such as paddingLeft and layout_marginLeft, use paddingStart and layout_marginStart. NOTE: If your minSdkVersion is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error. (Note: For Gravity#LEFT and Gravity#START, you can use these constants even when targeting older platforms, because the start bitmask is a superset of the left bitmask. Therefore, you can use gravity="start" rather than gravity="left|start".)

大致意思为left已经再api27中被start取代

原因

有些字的习惯是从右边开始写起的,这个时候marginleft就会失去预期的效果,而start则自动进行相应的判断并进行镜像切换

Application下的allowbackup属性

Warning:On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup. More info: https://developer.android.com/training/backup/autosyncapi.html

意思为应用程序数据将在应用程序安装上自动进行备份和恢复

消除

在application下

android:fullBackupContent="@xml/backup_descriptor">
并自动在xml包下创建backup_descriptor.xml
在这个xml文件中,可以定义需要备份(include)和不需要备份(exclude)的相关数据,并指定数据保存方式

AndroidManifast警告App is not indexable by Google Search

Warning: App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter. See issue explanation for more details.

官方文档

To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. These intent filters allow deep linking to the content in any of your activities. For example, the user might click on a deep link to view a page within a shopping app that describes a product offering that the user is searching for.

Deeplink有什么用

举例来说,当用户在其他应用或网页中点击了广告时,使用了Deeplink的商家APP,可以直接跳转到相应商品的界面;而没有使用Deeplink的APP,就只能跳转到首页。包括新闻APP的推送等等。

你可能感兴趣的:(安卓 warning(二))