【发布时间】:2017-03-23 02:36:18
【问题描述】:
我有 2 个视图(一个按钮和一个滑块),一个在另一个之上,我正在为较低的一个超出框架设置动画,并且我希望另一个视图也以相同的数量进行动画处理。我的问题是,下视图曾经是顶视图的位置。 (见图片)。两个动画都是由视图模型属性更改触发的。
TimeView.Animate().TranslationYBy(ViewModel.IsShowingEmployees ? -TimeView.Height : TimeView.Height);
MyPositionButton.Animate().TranslationYBy(ViewModel.IsShowingEmployees ? -TimeView.Height : TimeView.Height);
如何让下视图停止裁剪上视图?我试图改变视图的 Z 和 TransitionZ 属性以确保按钮高于栏。我还尝试在动画完成时将栏的可见性设置为 Gone。我还尝试使用 TranslateAnimation 以便我可以控制 Fill 属性。这些都没有奏效。
这里是axml。
<RelativeLayout
android:id="@+id/map_area_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/under_list_view">
<RelativeLayout
android:id="@+id/map_container_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/time_view"
android:layout_width="300dp"
android:layout_height="44dp"
android:background="#ddffffff"
android:layout_alignParentBottom="true">
<TextView
android:id="@+id/time_text_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="4:56PM"
android:textColor="@color/gray_dark"
android:textSize="18dp"
android:gravity="center_vertical"
android:layout_marginLeft="10dp" />
<SeekBar
android:id="@+id/time_seek_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:max="1440"
android:progress="700"
android:progressDrawable="@drawable/custom_scrubber_progress"
android:thumb="@drawable/custom_scrubber_control"
android:secondaryProgress="0"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/time_text_view" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/time_view"
android:layout_alignParentLeft="true"
android:layout_margin="5dp">
<ImageButton
android:id="@+id/my_location_button"
android:layout_height="50dp"
android:layout_width="50dp"
android:background="@drawable/ek_fab_button_ripple_white"
android:src="@drawable/ic_my_location_24p"
android:tint="@color/gray_dark" />
</RelativeLayout>
</RelativeLayout>
【问题讨论】:
标签: android animation xamarin.android android-animation