Так что я пытаюсь анимировать меньшую относительную компоновку вниз/вверх из другой относительной компоновки.Анимация относительной компоновки для перемещения вниз/вверх, например, Снек-бар
Я использовал this в надежде попытаться решить мою проблему. Я думал о том, чтобы делать что-то вроде снэк-бара, но мне все же хотелось бы добавить к нему изображение, что может быть проблемой само по себе. Идеи? Вот мой XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_log_in"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.esole.lithouse.SignUp"
android:background="#E6E6E6">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="?attr/actionBarTheme"
android:minHeight="?attr/actionBarSize"
android:id="@+id/logInBar"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
app:title="Log In" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:layout_marginTop="83dp"
android:id="@+id/editTextUsernameOrEmail"
android:imeOptions="actionNext"
android:layout_below="@+id/logInBar"
android:layout_centerHorizontal="true"
android:hint="username or email " />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:imeOptions="actionDone"
android:layout_centerVertical="true"
android:id="@+id/passwordLogIn"
android:hint="password "
android:layout_alignEnd="@+id/editTextUsernameOrEmail" />
<Button
android:text="Log In"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/LogIn"
android:layout_above="@+id/statusIndicator"
android:layout_centerHorizontal="true"
android:layout_marginBottom="67dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="75dp"
android:background="#006D6D"
android:id="@+id/statusIndicator"
android:animateLayoutChanges="true"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/indicatorStatusLabel"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@+id/imageView4"
android:layout_alignTop="@+id/imageView4"
android:layout_alignBottom="@+id/imageView4"
android:textAlignment="center"
android:textSize="24sp"
android:text="test "
android:typeface="normal"
android:lineSpacingExtra="24sp"
android:layout_marginRight="67dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="@drawable/refresh"
android:id="@+id/imageView4"
android:layout_marginStart="16dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Вот некоторые из кода я пытался использовать:
slideInAndOut = (RelativeLayout) findViewById(R.id.statusIndicator);
TranslateAnimation slide = new TranslateAnimation(0, 0, 0, -slideInAndOut.getHeight());
slide.setDuration(1000);
slide.setFillAfter(true);
slideInAndOut.startAnimation(slide);
slide = new TranslateAnimation(0, 0, slideInAndOut.getHeight(), 0);
slide.setDuration(1000);
slide.setFillAfter(true);
что случилось, когда вы пытаетесь что? –
Извините за задержку, в настоящее время она установлена в нижней части относительной компоновки. Поэтому, когда я добавил этот фрагмент кода для его перемещения. он все еще не двигался. Который привел меня сюда. –
мой ответ будет работать! но вы лучше выясните, что «Методы» в оригинальном ответе –