Android属性动画 实战-视差动画
生活随笔
收集整理的這篇文章主要介紹了
Android属性动画 实战-视差动画
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
轉(zhuǎn)載請標明出處:http://blog.csdn.net/zhaoyanjun6/article/details/118976533
本文出自【趙彥軍的博客】
文章目錄
- 效果圖
- 實例代碼
效果圖
先看看效果圖:
從效果上看就是布局文件從從屏幕右側(cè)飛入屏幕內(nèi),但不是一起飛入,而是有視差效果。
實例代碼
我們先寫布局:
<?xml version="1.0" encoding="utf-8"?><androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"><Buttonandroid:id="@+id/view1"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="pause" /><Buttonandroid:id="@+id/view2"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="resume" /><ImageViewandroid:id="@+id/view3"android:layout_width="match_parent"android:layout_height="200dp"android:src="@drawable/aa" /></androidx.appcompat.widget.LinearLayoutCompat>布局非常簡單,就是3個view( view1、view2、view3)。其中 view3 是一個ImageView 。看看預覽效果
編寫代碼:
代碼非常簡單,我就不一一解釋了,相信你能看明白
總結(jié)
以上是生活随笔為你收集整理的Android属性动画 实战-视差动画的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android属性动画 Property
- 下一篇: Android NDK学习笔记1:基础