Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 动画使用淡入从下到上的布局_Android_Android Layout_Android Animation - Fatal编程技术网

Android 动画使用淡入从下到上的布局

Android 动画使用淡入从下到上的布局,android,android-layout,android-animation,Android,Android Layout,Android Animation,我想要一个动画,首先是FadeIn屏幕上id为Symbol\u no的TextView,然后是FadeIn其他View symbolnotextview.animate().setDuration(duration). scaleX(1).scaleY(1). translationX(0).translationY(0). setInterpolator(sDecelerator). withEndAction(new Runnable() {

我想要一个动画,首先是FadeIn屏幕上id为
Symbol\u no
TextView
,然后是FadeIn其他
View

symbolnotextview.animate().setDuration(duration).
    scaleX(1).scaleY(1).
    translationX(0).translationY(0).
    setInterpolator(sDecelerator).
    withEndAction(new Runnable() {
        public void run() {
            // Animate the description in after the image animation
            // is done. Slide and fade the text in from underneath
            // the picture.
            mTextView.setTranslationY(-mTextView.getHeight());
            mTextView.animate().setDuration(duration/2).
            translationY(0).alpha(1).
            setInterpolator(sDecelerator);
        }
    });
但我想这不是我想做的

下面是设计的XML

  <LinearLayout        xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="100"
    android:id="@+id/toplevel">

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:orientation="horizontal"
    android:layout_weight="15"
    android:background="@drawable/borderframe">
    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:padding="5dp"
        android:src="@drawable/abc_btn_radio_to_on_mtrl_015"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="21477"
        android:padding="5dp"
        android:gravity="center"
        android:background="@drawable/border"
        android:id="@+id/Symbol_no"

        />

</LinearLayout>
<TextView
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:text="Rohit Shrestha"
    android:layout_weight="20"
    android:textSize="30sp"
    android:gravity="center"
    android:id="@+id/name"
    />
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="20"
    android:paddingLeft="25dp"
    android:paddingRight="25dp"
    android:id="@+id/parentblock">

    <TextView
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:text="Block"
        android:textSize="30sp"
        android:gravity="center"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/block_no"
        android:background="@drawable/border"/>

    <TextView
        android:layout_width="120dp"
        android:layout_height="fill_parent"
        android:text="7"
        android:gravity="center"
        android:textStyle="bold"
        android:layout_alignParentRight="true"
        android:textSize="40sp"
        android:id="@+id/block_no"
        android:background="@drawable/border"/>



</RelativeLayout>
<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="10"
    android:weightSum="100"
    android:paddingLeft="40dp"
    android:paddingRight="40dp"
    android:paddingTop="30dp"
    android:id="@+id/class_container"
   >
    <LinearLayout
        android:layout_weight="40"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="@drawable/border"
        android:gravity="center"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Class"
            android:textSize="30dp"
            android:gravity="center"
            android:id="@+id/class_text"
           />
        <TextView
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:id="@+id/room_no"
            android:textSize="25dp"
            android:gravity="center"
            android:text="8"/>

    </LinearLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_weight="40"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="@drawable/border"
        android:gravity="center"
        android:layout_marginLeft="15dp">
        <TextView
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:text="Seat"
            android:gravity="center"
            android:textSize="30dp"

            android:id="@+id/Seat_text"
            />
        <TextView
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:text="8"
            android:gravity="center"
            android:id="@+id/Seat_No"
            android:textSize="25dp"
           />

        </LinearLayout>



</LinearLayout>

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="15dp"
    android:text="Good Luck"
    android:gravity="center"
    android:id="@+id/display_notification"
    android:layout_weight="10"
    />

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/Time_Left"
    android:text="5 hours to go"
    android:gravity="center"
    android:textSize="20dp"
    android:layout_weight="10"
    />

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="10dp"
    android:text="15 july,2015"
    android:gravity="center"

    android:layout_weight="10"/>

这是输出:

试试这个:

Button btn = (Button)findViewById(R.id.Symbol_no);
    DisplayMetrics dis = getResources().getDisplayMetrics();

    TranslateAnimation anim = new TranslateAnimation(0, 0, dis.heightPixels, 0);
    anim.setDuration(1000);
    anim.setAnimationListener(new AnimationListener()
    {

        @Override
        public void onAnimationStart(Animation arg0)
        {


        }

        @Override
        public void onAnimationRepeat(Animation arg0)
        {


        }

        @Override
        public void onAnimationEnd(Animation arg0)
        {
            // show whatever you want to show after animation is finished.
        }
    });
    btn.startAnimation(anim);
试试这个:

Button btn = (Button)findViewById(R.id.Symbol_no);
    DisplayMetrics dis = getResources().getDisplayMetrics();

    TranslateAnimation anim = new TranslateAnimation(0, 0, dis.heightPixels, 0);
    anim.setDuration(1000);
    anim.setAnimationListener(new AnimationListener()
    {

        @Override
        public void onAnimationStart(Animation arg0)
        {


        }

        @Override
        public void onAnimationRepeat(Animation arg0)
        {


        }

        @Override
        public void onAnimationEnd(Animation arg0)
        {
            // show whatever you want to show after animation is finished.
        }
    });
    btn.startAnimation(anim);

你说的“FadeIn the TextView with id Symbol\u no from Bottom to Top”是什么意思?我的意思是,此文本视图必须从下到上,然后必须显示其他视图。看看我的答案。你说的“FadeIn the TextView with id Symbol\u no from Bottom to Top”是什么意思我的意思是这个文本视图必须从下到上,然后其他视图必须显示出来。看看我的答案。