相关疑难解决方法(0)

XML中"缺少图像上的contentDescription属性"

我在eclipse中的图像上收到关于[辅助功能]缺少contentDescription属性的警告.此警告显示在ImageView下面的XML代码中的第5行(声明).

这在构建和运行我的应用程序时不会出现任何错误.但我真的想知道为什么我会收到这个警告.

这是我的XML文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/contact_entry_image"
        android:src="@drawable/ic_launcher"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <TextView
        android:id="@+id/contact_entry_text"
        android:text=""
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个问题并感谢您的阅读.

eclipse android warnings accessibility android-imageview

207
推荐指数
8
解决办法
26万
查看次数

Android Lint contentDescription警告

我收到警告,因为"[可访问性]在图像上缺少contentDescription属性"for imageview.而使用android lint

那是什么意思?

android android-layout android-lint

126
推荐指数
7
解决办法
11万
查看次数

可能的透支:根元素绘制背景

在我的应用程序中,它出现在Android的lints上的这个警告:

可能的透支:根元素绘制背景@ drawable/main,主题也绘制背景(推断的主题是@android:style/Theme)

我想知道如何纠正这个错误,因为在检查和检查互联网后,我发现它正在降低应用程序速度导致它重新加载两倍的背景来放置此源.

这是我的layout.xml的源代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main"
    android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="120dp"
    android:layout_centerHorizontal="true"
    android:layout_marginLeft="20dp"
    android:text="@string/alta1"
    android:textColor="#000"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView1"
    android:layout_marginTop="20dp"
    android:layout_centerHorizontal="true"
    android:text="@string/alta2"
    android:layout_marginLeft="20dp"
    android:textColor="#000"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<Button
    android:id="@+id/continuaralta"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/textView2"
    android:layout_marginRight="50dp"
    android:layout_marginTop="36dp"
    android:textStyle="bold"
    android:background="@drawable/boton"
    android:text="@string/continuar" />

<Button
    android:id="@+id/saliralta"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/continuaralta"
    android:layout_alignBottom="@+id/continuaralta"
    android:layout_marginRight="15dp"
    android:layout_toLeftOf="@+id/continuaralta"
    android:background="@drawable/boton"
    android:textStyle="bold"
    android:text="@string/salir" />
Run Code Online (Sandbox Code Playgroud)

android-layout

4
推荐指数
1
解决办法
9819
查看次数