C Sharper
C Sharper

Reputation: 8626

background image to app giving me error

I wanted to put background image to my app.

I kept image in res>drawable-hdpi folder.

Seted my image view as:

<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"/>

But its giving me error in the form of tooltip on line:

error: Error: String types not allowed (at 'src' with value 'res/drawable-hdpi/capture.PNG').

Am i pasting image in wrong folder?

Or code is wrong??

Please help me.

Upvotes: 0

Views: 910

Answers (4)

Kirti
Kirti

Reputation: 701

android:src="@drawable/capture"

put this.

Upvotes: 1

Piyush
Piyush

Reputation: 18933

change

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

with

android:src="@drawable/capture"

Upvotes: 1

MysticMagicϡ
MysticMagicϡ

Reputation: 28823

Replace

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

with

android:src="@drawable/capture"

Hope it helps.

Upvotes: 1

Sunil Kumar
Sunil Kumar

Reputation: 7092

try this, put capture.png in any drawable folder

android:src="@drawable/capture"

Upvotes: 2

Related Questions