Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android開發常見報錯

Android開發常見報錯

編輯:關於Android編程

1.報錯信息:
[Accessibility] Missing contentDescription attribute on image

詳細信息:
Explanation: Image without contentDescription 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.
解釋:
在一些沒有文本顯示的控件裡,如imageView和imageButton等,ADT會提示你定義一個android:contentDescription屬性,用來描述這個控件的作用。

2.報錯信息:This tag and its children can be replaced by one and a compound drawable
解決如下:
前:






後:

3.報錯信息:Hardcoded string “計算器”, should use @string resource
解決:將xml布局中直接使用的字符串在string資源文件中設置,在xml中進行引用即可。

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved