문제

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