查看动画仅第二次工作

时间:2017-08-29 09:05:10

标签: android animation android-animation

我试图让match(projects:Project {name:'IRIS Recognition Java'}) create(client:Client {name:'Andreas Pal'}) CREATE(projects)-[w:IS_PART_OF]->(client) return w 向上和向外滑动,然后让另一组按钮滑入其中,我的问题是第二个按钮没有&#t} t& #34;滑动"在第一次,只从第二次和以后。我尝试将按钮容器ImageButton设置为不可见而不是消失,但它对动画没有影响,只是将按钮拆分到父视图的顶部和底部。

XML

Visibility

显示动画方法

<LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="200dp"
                    android:layout_columnWeight="1"
                    android:layout_gravity="fill"
                    android:background="#ffffff"
                    android:gravity="center"
                    android:orientation="vertical">

                    <ImageButton
                        android:id="@+id/user_email_show"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_columnWeight="1"
                        android:layout_gravity="fill"
                        android:background="#ffffff"
                        android:onClick="showEmail"
                        app:srcCompat="@drawable/logo_email" />+

                    <LinearLayout
                        android:id="@+id/user_email_container"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:visibility="gone">

                        <ImageButton
                            android:id="@+id/user_email_add"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:backgroundTint="#FFF"
                            android:onClick="addEmail"
                            android:visibility="gone"
                            app:srcCompat="@drawable/ic_add" />

                        <TextView
                            android:id="@+id/user_email"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:visibility="gone" />

                        <LinearLayout
                            android:id="@+id/user_email_input"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:visibility="gone">

                            <ImageButton
                                android:id="@+id/user_email_edit"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:backgroundTint="#FFF"
                                android:onClick="editEmail"
                                app:srcCompat="@drawable/ic_edit" />

                            <ImageButton
                                android:id="@+id/user_email_delete"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:backgroundTint="#FFF"
                                android:tint="#a7a7a7"
                                app:srcCompat="@drawable/ic_delete" />
                        </LinearLayout>

                        <ImageButton
                            android:id="@+id/user_email_hide"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:background="#FFF"
                            android:onClick="hideEmail"
                            android:tint="#a7a7a7"
                            android:padding="15dp"
                            android:visibility="gone"
                            app:srcCompat="@drawable/ic_cancel" />
                    </LinearLayout>
                </LinearLayout>

动画文件

public void showEmail(View view) {

    findViewById(R.id.user_email_hide).setVisibility(View.VISIBLE);

    if (emailCheck == true) {
        emailTextView.setVisibility(View.VISIBLE);
        emailInput.setVisibility(View.VISIBLE);
    } else {
        addEmail.setVisibility(View.VISIBLE);
    }

    final Animation slide_up_in = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up_in);
    Animation slide_up_out = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up_out);

    showEmail.startAnimation(slide_up);


    slide_up_out.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            showEmail.setVisibility(View.GONE);

            emailContainer.setVisibility(View.VISIBLE);

            emailContainer.setAnimation(slide_up_in);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
}

0 个答案:

没有答案