Question

I have got a card flip animation witch works fine, the only problem that I am facing is that every time I flip my device (from landscape to portrait and vice versa) my screen layout is recreated again, that means: if I was in second face of the card, when I flip my device the first reappears, And I want the second to still be displayed how can I handle that?

Était-ce utile?

La solution

One option is to tell android that you will handle when the screen changes orientation, so that onCreate() is not called again when the screen changes orientations. To do this, add an entry for the specific activity in your manifest file. It should look something like this:

<activity
        android:name="com.package.name.Activity"
        android:configChanges="orientation"
        android:label="@string/title_activity"
        android:parentActivityName="com.package.name.Parent" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.package.name.Parent" />
</activity>

the line android:configChanges is what I'm referring to

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top