Reputation: 744
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:
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.
Upvotes: 6
Views: 33006
Reputation: 159
You can also try to disable hardware acceleration to the view you are setting background
myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
and then set the background
Upvotes: 0
Reputation: 131
Make sure it doesn't say (24)
or (v 24)
next to the image file you have in your drawable file, re-copy the image and make it save it as the type with no (24)
in it as it will prepare it to be used for API 24
and above, my phone uses that's why it failed on my part API 23
.
Upvotes: 0
Reputation: 61
you may need to add this to your manifest file . android:hardwareAccelerated="false" , android:largeHeap="true"
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
android:hardwareAccelerated="false"
android:largeHeap="true"
android:theme="@style/AppTheme">
Upvotes: 6
Reputation: 1076
Try with a lower-resolution background. The one you are trying might be too big. You can check that in your logcat.
Upvotes: 33
Reputation: 825
Decrease Height And Width of the Image . This will solve problem . You can see image too large error generated by logcat also
Upvotes: 0
Reputation: 1
Save the image in every folder of drawable like in xhdpi,xxhdpi,xxxhdpi with respect to thier resolution.
Upvotes: 0
Reputation: 3539
Need to check drawable size.Add the image in four resolutions.
http://developer.android.com/guide/practices/screens_support.html
Upvotes: 0
Reputation: 2972
In your logcat you will see a message like this:
Bitmap too large to be uploaded into a texture (2496x4437, max=4096x4096)
The max is 4096x4096
which is the value GL_MAX_TEXTURE_SIZE
for the version of OpenGL that is running on the device.
Upvotes: 15
Reputation: 2368
Try removing those underscores given to the name of the drawable.
Upvotes: 0