Background image crashes android

我的梦境 提交于 2020-01-24 14:09:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!