chility chility - 3 years ago 174
Android Question

Android device is not showing the background image

I have created a project, targeting

android 4.4 - API Level 19
, as suggested by eclipse.

Anyways, on the emulator everything looks perfect - here is a screenshot:

app screenshot

The problems comes when I install it on my real device - running android
4.1.2
. Everything is just perfect and working like a charm, excepting the background image. It is showing a white background, like the picture does not exists.

Here is my xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical"
android:gravity="center"
android:padding="30dp"
android:background="@drawable/wg_blurred_backgrounds_12"
>

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnTopJokes"
android:onClick="showTopJokes"
android:gravity="center"
/>

<Button
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnNewJokes"
android:onClick="showNewJokes"
android:gravity="center"
/>

<Button
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnAllJokes"
android:onClick="showAllJokes"
android:gravity="center"
/>

<Button
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnMyFavorites"
android:onClick="showFavorites"
android:gravity="center"
/>

<Button
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnCategories"
android:onClick="showCategories"
android:gravity="center"
/>

<Button
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnAddNewJoke"
android:gravity="center"
/>

</LinearLayout>


Isn't
android:background="@drawable/wg_blurred_backgrounds_12
working on android
4.1.2
?

Do I have to change anything in the premissions? Here is what I have now:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />


I know that I miss something really small, but I'm not able to spot it as a beginner.

Answer Source

Try with a lower-resolution background. The one you are trying might be too big. You can check that in your logcat.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download