Ich habe ein Layout in Top-Position und diese Ansicht ist zum ersten Mal ausblenden.Ich würde tun, Slide oben und unten Animation mit programmatisch.Ich schrieb Code und dieser Code funktioniert nur perfekt erstmals ist es hierSlide Up/Down-Animation funktioniert nicht richtig in der zweiten Zeit
public void cutomTabDropDownAnimation(LinearLayout view, boolean isSlideDown) {
TranslateAnimation animate;
if (isSlideDown) {
animate = new TranslateAnimation(
0,
0,
0,
view.getHeight()); // toYDelta
} else {
animate = new TranslateAnimation(
0,
0,
view.getHeight(),
0); // toYDelta
}
animate.setDuration(300);
animate.setFillAfter(true);
animate.setInterpolator(new BounceInterpolator());
view.setAnimation(animate);
if (isSlideDown)
view.setVisibility(View.VISIBLE);
else
view.setVisibility(View.GONE);
}
In zweites Mal wird die erste Blick zeigt und dann Animation begonnen, aber nicht richtig ist, verborgen. Hier ist eine XML-Datei Quelle
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/myCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f2f2">
<LinearLayout
android:id="@+id/customTabLayout"
android:layout_width="match_parent"
android:layout_height="49dp"
android:background="#ffffff"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<View
android:id="@+id/view"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@color/colorPrimary"
/>
<TextView
android:id="@+id/firstTab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignEnd="@+id/view"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/view"
android:gravity="center"
android:text="@string/u_four_tab_1"
android:textColor="#405a97"
android:textSize="16dp" />
<TextView
android:id="@+id/secondTab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/view"
android:layout_alignParentTop="true"
android:layout_alignStart="@+id/view"
android:gravity="center"
android:text="@string/u_four_tab_2"
android:textColor="#d4d4d4"
android:textSize="16dp"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#801d7aed" />
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/customTabLayout">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false" />
</android.support.v4.widget.NestedScrollView>
<LinearLayout
android:id="@+id/empty_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="40dp"
android:gravity="top|center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/empty_layout_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/u_empty_package"
android:textColor="#808080"
android:textSize="16dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="46dp"
android:background="@mipmap/package_grey" />
</LinearLayout>
ich meine customTabLayout lineare Layout in xml file.How ich dieses Problem lösen kann?
Ich änderte aber nichts anderes @Jaja – BekaKK