Problems with layout using <uses-sdk android:minSdkVersion - Android
I was publishing my first APP but i have a problem, I have tested my app with a lot of AVD then i tested with my phone(Galaxy S) and with my girlfriend phone (Galaxy 5) before publishing, when i tried to publish i received a msg to specify an API level requirement. then i put this code
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="7"
/>
then i tested in the AVD and i had no problem, but when i publish and tested in my Galaxy S, i encountered a crazy layout of my app, i do no why, so i go back to the Eclipse and tested direct to my galaxy S and get the same error, so i take this part of the code out and then tried again in my galaxy S and the layout is all OK, so i`m probably doing some thing wrong.
开发者_运维百科Many Thanks Sorry my poor English i`m from Brazil.
I think it is do with your layout defintion. What values have you used for layout_width and layout_height? (for layout and widgets)? You should use "wrap_content" of "fill_parent" and if you are forced to give exacts, give values in dip (100dip) rather than px or pix. Read this doco for more details http://developer.android.com/guide/practices/screens_support.html
It may be because your 2 phones have different android versions. Do this, create 2 emulators with exact same android version, screen size and density as your 2 phones and test and debug there.
Leave the minSDK declaration and get rid of the target SDK. You are using two separate declarations.
<uses-sdk android:minSdkVersion="4"/>
This is the only one you need.
I have seen this too. My app runs on everything from api level 4 and up. When I add
<uses-sdk android:minSdkVersion="4"/>
to my manifest and run on my G2 I get a crazy layout. Thanks for this heads-up. I will report later on the changes I had to make.
m.
精彩评论