简体   繁体   English

开始活动前进行动画前

[英]Pre Animation before starting an Activity

I would like to have some pre-animation before starting My android app. 我想在启动我的android应用之前进行一些预动画。 Let me tell me you how am i doing it right now. 让我告诉你我现在如何做。

I am having another activity which has an ImageView , i open that activity in the background transparent mode and have a delay of 2seconds and then my homescreen is opened. 我正在执行另一个具有ImageView的活动,我以背景透明模式打开了该活动,并延迟了2秒,然后打开了我的主屏幕。 Now in this concept the problem is that when i press back button at the homescreen, i am jumped to that animation and so i have to press back again. 现在,在这个概念中,问题是当我在主屏幕上按“后退”按钮时,我跳到该动画,因此必须再次按回去。

Now i would like to add animation like we see in the facebook app. 现在,我想添加动画,就像我们在facebook应用程序中看到的那样。 I want that first an imageview should appear , then it sould move upwards and then 2 textviews should appear with the dissolve effect. 我希望首先出现一个imageview,然后向上移动,然后出现2​​个具有溶解效果的textview。 Can anybody tell me how would i make it ? 有人可以告诉我我怎么做吗?

make a frame layout for ur activity like this 为这样的活动制作框架布局

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
     >
<ImageView
android:id="@+id/image"
    android:src="@drawable/andro"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    />
<LinearLayout>
//Other Component Activity
</LinearLayout>
</FrameLayout>

then in Activity onCreate method make other component Invisible using method setVisibility(View.INVISIBLE) and after 2 seconds make your code component visible by using method setVisibility(View.VISIBLE) and make visibility of your ImageView invisible. 然后在Activity onCreate方法中使用setVisibility(View.INVISIBLE)方法使其他组件不可见,并在2秒钟后使用setVisibility(View.VISIBLE)方法使您的代码组件可见,并使ImageView的可见性不可见。 in this way when you press back button in no animation you will see and you will get what you need. 这样,当您在没有动画的情况下按返回按钮时,您将看到并获得所需的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM