开发者

Hidding the title bar on specific layouts that use ViewFlipper, and transitions not working properly

First off I am a beginner in Android development; I have been doing a lot of research into how to get the various tasks I am trying to complete. I have yet to find any similar issue to this, which is why I am asking it.

This is a multipart question.

Overview of program and problems: I have a program (for Android 2.1 and higher) that has multiple fullscreen Activities. I am required to have a different animation for transitioning to each one. So I reconfigured a couple files and made a ViewFlipper to do the transitions. Unfortunately some of these activities use a title. At the same time the transitions that I have tried applying based on the tutorials I have found online are not working as expected. The transition begins, the second screen is shown (faded) and the background is black, as the second screen nears completion of the transition the first screen reappears before disappearing again.

Question 1: Is there a way to display some layouts with a title and some without? If not then is there a way to change the transition used when startActivity is used?

Question 2: Is there some method of doing a fade transition without it flashing the original screen? I looked up the "flicker" issue but the solutions are not working for my project.

Question 3: In a similar manner to the 2nd question, the first layout shown is a loading screen, then the main screen. This happens just fine but for some reason the loading screen is 开发者_开发百科shown, then slides off (as if startActivity is called) and then it fades into existence again (this time with a title which isn't supposed to be there), then switches to the main screen correctly. What might be happening here?

If you have any questions, feel free to ask.


Q1: yes it's possible, you can set the flag for each activity

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

or in xml via style:

    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>

Q2: yes, that should be the usual way. But to answer your question we need to see the code you're using. If you want to change the transitions of an activity (not view), you can put in it's onCreate method:

    super.overridePendingTransition(R.anim.bounce, R.anim.fadeout);

to define which animation to show when the activity enters the screen. You can use the same method in onFinish().

Q3: as Q2: need to see your code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜