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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top