These days in writing Android apps, there's something really weird about this:
A picture resource is set on the layout as a background and can be displayed in the Eclipse's layout design interface, but the picture is completely out of view when the emulator is started;
But the truth is far from simple. Later I put the application package to a few friends of my test, found that the picture is not displayed.
Among them, my application support version is 2.1, the simulator version is 2.1, my machine version is 4.0, two friend's machine is 2.1 and 2.3 respectively. So I guess the picture is not compatible with 2.1 and 2.3, so we set up a separate project to test the diagram, and it turns out to be a show.
Why this diagram is not displayed on my application, can be displayed on the test application, and it is related to the version ...
After a toss and a variety of hypotheses and experiments found a solution:
The name of the diagram is the beginning of a, so in the first, Android automatically generates the R-class resource index, which is indexed to 0x7f040000, with 0 wood behind it! I found that as long as the index is 0x7f040000 picture resources, in my application can not be displayed, so I throw in a useless picture named Aaa.png let it in the first occupy 0x7f040000 this index, then, everything is normal.
Question: Although the problem has been solved, why is the same picture resource index in the test project 0x7f040000 can also be displayed? I guess it might be that my app uses some other XML-defined drawable resource conflicts, maybe Android bugs, but how exactly this problem is generated is still unclear.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/