应用程序的背景图像给我错误

时间:2013-09-03 08:11:44

标签: android android-layout

我想将背景图片添加到我的应用中。

我将图片保存在res> drawable-hdpi文件夹中。

将我的图片视图设为:

<LinearLayout
   android:id="@+id/tv_un"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt"
android:textColor="#444444"            
    android:orientation="vertical" >


     <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" 
android:src="res/drawable-hdpi/capture.PNG"/>

但它在线上以工具提示的形式给我错误:

  

错误:错误:不允许字符串类型(在'src'处有值   'RES /抽拉-HDPI / capture.PNG')。

我将图片粘贴到错误的文件夹中吗?

或者代码错了?

请帮帮我。

4 个答案:

答案 0 :(得分:2)

试试这个,将capture.png放入任何可绘制的文件夹

android:src="@drawable/capture"

答案 1 :(得分:1)

替换

android:src="res/drawable-hdpi/capture.PNG"

android:src="@drawable/capture"

希望它有所帮助。

答案 2 :(得分:1)

更改

android:src="res/drawable-hdpi/capture.PNG"

android:src="@drawable/capture"

答案 3 :(得分:1)

android:src="@drawable/capture"

把这个。

相关问题