0

上のビューの動きに応じて下のビューのサイズも変更しながら、ビューでアニメーションを翻訳する方法についても、Google では手がかりがありません。

だから、私はこのコードを持っています:

<LinearLayout
    android:id="@+id/content_layout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/mode"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

そしてこのJavaコード:

TextView view = (TextView) findViewById(R.id.mode);
mHideAnimation = ObjectAnimator.ofFloat(view, "translationY", view.getY() + 50, view.getY());
mShowAnimation = ObjectAnimator.ofFloat(view, "translationY", view.getY(), view.getY() + 50);
mHideAnimation.setDuration(1000);
mShowAnimation.setDuration(1000);

そして後で私は電話します:

mShowAnimation.start();

また

mHideAnimation.start();

Textview の翻訳中に Listview のサイズを自動的に変更する方法を教えてくれる人はいますか?

4

0 に答える 0