图像上缺少contentDescription属性

时间:2013-08-18 10:50:36

标签: android xml button layout imagebutton

我已经收到类似主题的警告,我已经用谷歌搜索了但是添加描述并没有解决我的问题,R.java没有生成,我试图清理和重建而没有...我的.xml文件是什么错

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >

<ListView
    android:id="@+id/listViewPlayer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/buttonPrev"
    android:layout_alignParentTop="true"
    android:layout_alignLeft="@+id/seekBar1"
    android:layout_centerHorizontal="true" />

<SeekBar
   android:id="@+id/seekBar1"
   android:layout_width="200dp"
   android:layout_height="wrap_content"
   android:layout_alignParentBottom="true"
   android:layout_marginBottom="16dp" />

<ImageButton
    android:id="@+id/buttonPrev"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_above="@+id/seekBar1"
    android:layout_alignLeft="@+id/seekBar1"
    android:src="@drawable/rewind" />

<ImageButton
    android:id="@+id/buttonPlay"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_above="@+id/seekBar1"
    android:layout_toRightOf="@+id/buttonPrev"
    android:src="@drawable/play" />

<ImageButton
    android:id="@+id/buttonForw"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_above="@+id/seekBar1"
    android:layout_toRightOf="@+id/buttonPlay"
    android:src="@drawable/fast_forward" />

<ImageButton
    android:id="@+id/buttonShuffle"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_above="@+id/seekBarVolume"
    android:layout_alignLeft="@+id/seekBarVolume"
    android:src="@drawable/shuffle" />

 <ImageButton
    android:id="@+id/buttonRepeat"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_above="@+id/seekBarVolume"
    android:layout_alignRight="@+id/seekBarVolume"
    android:src="@drawable/repeat" />

<SeekBar
    android:id="@+id/seekBarVolume"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/seekBar1"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="16dp" />


</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

由于某些错误,R.java没有生成。它也可能在文件中。我可以建议的一件事是,只有在第一次定义它时才需要使用@+id/..。例如,您已经在ListView中定义了Seekbar:

<ListView
    ...
    android:layout_above="@+id/buttonPrev"
    >

所以现在您不需要再次使用+来获取相同的ID。对于其他地方,您可以删除ID

前面的+
<SeekBar
   android:id="@id/seekBar1"

其他ID也有类似的模式。

相关问题