Reputation: 73
hi i have created a scrollview application with button, i have added a background image but the background works on the emulator but not on a real device, any help will be appreciated, im using an imageview as a background!
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="3500dp"
android:adjustViewBounds="true"
android:background="@drawable/iphonebg"
android:clickable="false"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:contentDescription="@string/background_desc"
>
</ImageView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/callButton"
android:background="@drawable/callnow1"
android:layout_marginTop="261dp"
android:onClick="callButtonClicked"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/orderButton"
android:layout_alignEnd="@+id/orderButton" />
i can scroll down its a long image and it works perfectly but on a real device the scroll is working and the buttons are in the right place just the background doesnt show?
Upvotes: 1
Views: 1068
Reputation: 923
You should set the background image as a @drawable
XML resource. That way, you can set it as the background using android:background="@drawable/..."
for whatever layout you want it to be the background of (either the ScrollView or the RelativeLayout).
Upvotes: 1