2012-01-02 18 views
13

にcontentDescription属性がありません[アクセシビリティ]欠落contentDescription属性IMAGEBUTTONは私にエラーを与える:画像上の[アクセシビリティ]画像

このエラーは何を意味し、どのように私はそれを修正することができますか?

<ImageButton 
    android:id="@+id/callbannerbuttonpg1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="157dp" 
    android:background="@null" 
    android:src="@drawable/callbanner" 
    android:visibility="invisible" /> 

答えて

16

Designing for Accessibility

は「簡単にビューの内容を説明するテキストを定義します。このプロパティは、いくつかのビューは、この属性は、このような提供するために使用することができるテキスト表現を持っていませんので。主に、アクセシビリティのために使用されています。」

これは単なる警告ではありません。この属性の使用はオプションです。あなたのIMAGEBUTTON

アンドロイドで

+0

おかげで は、いや、私は、通常のボタンと並んで画像ボタン側を使用して、私は彼らが再び二つの異なる感謝を作りたかっ推測する方法を教えるチュートリアルからそれを使用して、魔法のように働きました。 – user1091368

+1

「アクセシビリティのための設計」リンクは404になりましたが、同じコンテンツがここにあります:http://developer.android.com/guide/topics/ui/accessibility/apps.html –

5

使用この行を:contentDescription = "@文字列/ DESC"

3

はちょうどこの追加:

android:contentDescription="@string/description" 

をそしてあなたのstrings.xmlに行くと追加これは:

<string name="description"> YOUR_DESCRIPTION_HERE </string> 

コード:

<ImageButton 
    android:id="@+id/callbannerbuttonpg1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="157dp" 
    android:background="@null" 
    android:src="@drawable/callbanner" 
    android:visibility="invisible" 
    android:contentDescription="@string/description" /> 
関連する問題