开发者

problem while changing the orientation in app

开发者 https://www.devze.com 2023-02-16 17:04 出处:网络
i have already posted my issue in SO and got an answer but i have a problem in that too my former question is

i have already posted my issue in SO and got an answer but i have a problem in that too

my former question is "i have created a quiz game in my app. The game is to be played in portrait mode. After the game gets over the score is been calculated and its been showed in the score page when i click ok a pop up window appears and asks for the name. I have placed an option to share the result in facebook and twitter.

now when i enter the name and click ok, a page with score name and share button appears, if i clic开发者_运维问答k share it moves into facebook or the other, but if i change over to landscape mobe my app gets crashed."

i got a solution to add a line in manifest file

 <activity android:name=".main" 
        android:configChanges="orientation" />

along with the following code in the class file

@Override

public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); }

This answer helps me to move to next operation without crashing my app but the problem is when i change from landscape to portrait, the background image and text also gets changed to portrait and half the screen the seems to be a blank one and text or not appearing fully.

this is the same when changed from landscape to orientation. i want the image and text to be fitted to proper orientation.

this problem has not occured before entering those manifest and coding lines

pls give me a solution.


You could try an explicit definition of your layouts.

For example have two layout files, one for landscape and another for portrait. Android is intelligent enough to use the best available layout -> Read HERE

To handle screen orientation gracefully there is something more you need to do -> Read HERE

0

精彩评论

暂无评论...
验证码 换一张
取 消