问题
My application crashes when i put background line like in this code. When i delete this line my application works fine and also when i use another photo it also works. What's the problem?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/table2" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
The background for the main screen works fine also. But in the second page, it is problamatic.
回答1:
Thanks to you all. I changed the dimensions from 2500x1900 to 1280x920, now it works.
回答2:
If you are using only drawable folder to store all images.then change storage folder for high resolution images in drawable-xhdpi folder or higher. Hope this helps.
回答3:
Make sure about the image path if it is in drawable folder..put it inside Mipmap folder in your project directory.
来源:https://stackoverflow.com/questions/14242303/background-image-crashes-android