Gingerbread - Inflated XML View Has Black Space
I am messing with a test application, and part of it is creating a new window and inflating a view to it, to be used as a settings screen. This has always worked fine for me, but yesterday I upgraded my phone to 2.3.3 (And I have never been able to use Gingerbread or higher versions on the emulator for some reason) and now there is a strange black background behind the window. It looks to be some default Gingerbread window being created, and then simply pasting in my XML view over it.
If I, on the Window, use setLayout and have it set to wrap content, it seems to almost wrap on the Y (Still a little black showing, but I could live with that), but the black background stretches all the way across on the X. Ideally I could get it to wrap around the settings window XML perfectly, so it could be universal without a lot of additional work.
I also tried other ways, including just putting in hard coded numbers, or having it vary depending on the pixel width of the screen, and while these did shrink the black space (Though it was 开发者_JAVA百科still there obviously), it caused another anomaly. If I force the window to shrink that way, which isn't ideal anyway, then the black actually extends beyond its own border. It is a little difficult to explain, but basically, the border ends, but the black background goes a little further, and it just looks awful.
I'm not quite sure how to deal with this, keeping in mind that I don't want to change how it works with the other versions of Android, which worked perfectly. Any help would be greatly appreciated, thank you.
You should set the support screens types in the AndroidManifest.xml
like this:
<supports-screens android:smallScreens="false" android:largeScreens="true" android:normalScreens="true" android:anyDensity="true"/>
Also try to set midSdkVersion
for your application in the AndroidManifest.xml
.
精彩评论