【发布时间】:2017-06-05 06:44:36
【问题描述】:
我想通过动画将这个 imageview 从 relative_bottom 转换为 relative_top 布局。我想将该图像放在 relative_top 布局的中心。这是我的启动画面,所以我希望它自动传输。
here is hiiii as imageview.I want to animate this automatically:
我不知道如何设置确切的位置。
- 我应该添加什么来获得这样的输出?我尝试了很多方法,但无法找到解决方案。
示例 xml 文件:
<LinearLayout android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:layout_weight="2"
android:layout_gravity="center"
android:id="@+id/relative_top"
android:orientation="vertical">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:id="@+id/bottom"
android:layout_gravity="center_horizontal"
android:gravity="top">
<ProgressBar>
....
</Progressbar>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/relative_bottom"
android:layout_alignTop="@id/progressBar"
android:layout_centerInParent="true"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageview"
android:src="@drawable/logo"
android:scaleType="fitCenter"
/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
【问题讨论】:
-
为两个位置添加图片,这样可以帮助您轻松理解问题。
-
你试过这种方式吗:- stackoverflow.com/a/22370395/7806873
-
@NitinPatel 我已经编辑了我的问题。请检查
标签: android android-layout animation android-animation