引导页面的移动箭头效果 guide arrow animation

2024-03-02 09:48

本文主要是介绍引导页面的移动箭头效果 guide arrow animation,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

要实现类似效果


由于动画是非平滑的,所以不能用平移的方式来实现,这里就定时去更新在父布局的位置来是实现

先看布局代码

<RelativeLayoutandroid:id="@+id/swipe_layout"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="bottom|right"android:layout_marginBottom="10dip" android:layout_marginRight="10dip"><RelativeLayoutandroid:id="@+id/guide_arrow"android:layout_width="wrap_content"android:layout_alignParentRight="true"android:layout_height="20dip" ><ImageViewandroid:id="@+id/guide_arrow_1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:src="@drawable/guide_arrow" /><ImageViewandroid:id="@+id/guide_arrow_2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/guide_arrow_1"android:alpha="0.7"android:src="@drawable/guide_arrow" /><ImageViewandroid:id="@+id/guide_arrow_3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/guide_arrow_2"android:alpha="0.3"android:src="@drawable/guide_arrow" /></RelativeLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/guide_arrow"android:layout_alignParentRight="true"android:layout_marginTop="5dip"android:textSize="12sp"android:textColor="@color/white"android:text="@string/swipe_up" /></RelativeLayout>
实现代码:

@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.new_guide);swipeView = findViewById(R.id.swipe_layout);iv1 = (ImageView) findViewById(R.id.guide_arrow_1);iv2 = (ImageView) findViewById(R.id.guide_arrow_2);iv3 = (ImageView) findViewById(R.id.guide_arrow_3);iv1.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {@Overridepublic void onGlobalLayout() {// TODO Auto-generated method stubiv1Left = iv1.getLeft();iv1Height = iv1.getHeight();iv1Right = iv1.getRight();iv1Top = iv1.getTop();iv1Temp = iv1Top;iv1.getViewTreeObserver().removeGlobalOnLayoutListener(this);handler.post(arrowRunable);}});}class ArrowRunable implements Runnable {@Overridepublic void run() {// TODO Auto-generated method stubiv1.layout(iv1Left, iv1Temp - iv1Height-1, iv1Right, iv1Temp-1);iv2.layout(iv1Left, iv1Temp, iv1Right, iv1Temp + iv1Height);iv3.layout(iv1Left, iv1Temp + iv1Height+1, iv1Right, iv1Temp + 2*iv1Height+1);iv1Temp -= iv1Height;if (iv1Temp + 3 * iv1Height < 0) {iv1Temp = iv1Top;}handler.postDelayed(this, 180);}}@Overrideprotected void onDestroy() {// TODO Auto-generated method stubsuper.onDestroy();if (handler != null && arrowRunable != null) {Logger.d("removeCallbacks");handler.removeCallbacks(arrowRunable);}}
ok,这样应该就可以了,大家有更好的,欢迎交流


这篇关于引导页面的移动箭头效果 guide arrow animation的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/765718

相关文章

MySQL表锁、页面锁和行锁的作用及其优缺点对比分析

《MySQL表锁、页面锁和行锁的作用及其优缺点对比分析》MySQL中的表锁、页面锁和行锁各有特点,适用于不同的场景,表锁锁定整个表,适用于批量操作和MyISAM存储引擎,页面锁锁定数据页,适用于旧版本... 目录1. 表锁(Table Lock)2. 页面锁(Page Lock)3. 行锁(Row Lock

Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)

《Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)》文章介绍了如何使用dhtmlx-gantt组件来实现公司的甘特图需求,并提供了一个简单的Vue组件示例,文章还分享了一... 目录一、首先 npm 安装插件二、创建一个vue组件三、业务页面内 引用自定义组件:四、dhtmlx

禁止HTML页面滚动的操作方法

《禁止HTML页面滚动的操作方法》:本文主要介绍了三种禁止HTML页面滚动的方法:通过CSS的overflow属性、使用JavaScript的滚动事件监听器以及使用CSS的position:fixed属性,每种方法都有其适用场景和优缺点,详细内容请阅读本文,希望能对你有所帮助... 在前端开发中,禁止htm

Python重命名文件并移动到对应文件夹

《Python重命名文件并移动到对应文件夹》在日常的文件管理和处理过程中,我们可能会遇到需要将文件整理到不同文件夹中的需求,下面我们就来看看如何使用Python实现重命名文件并移动到对应文件夹吧... 目录检查并删除空文件夹1. 基本需求2. 实现代码解析3. 代码解释4. 代码执行结果5. 总结方法补充在

前端原生js实现拖拽排课效果实例

《前端原生js实现拖拽排课效果实例》:本文主要介绍如何实现一个简单的课程表拖拽功能,通过HTML、CSS和JavaScript的配合,我们实现了课程项的拖拽、放置和显示功能,文中通过实例代码介绍的... 目录1. 效果展示2. 效果分析2.1 关键点2.2 实现方法3. 代码实现3.1 html部分3.2

基于Python实现PDF动画翻页效果的阅读器

《基于Python实现PDF动画翻页效果的阅读器》在这篇博客中,我们将深入分析一个基于wxPython实现的PDF阅读器程序,该程序支持加载PDF文件并显示页面内容,同时支持页面切换动画效果,文中有详... 目录全部代码代码结构初始化 UI 界面加载 PDF 文件显示 PDF 页面页面切换动画运行效果总结主

使用JavaScript将PDF页面中的标注扁平化的操作指南

《使用JavaScript将PDF页面中的标注扁平化的操作指南》扁平化(flatten)操作可以将标注作为矢量图形包含在PDF页面的内容中,使其不可编辑,DynamsoftDocumentViewer... 目录使用Dynamsoft Document Viewer打开一个PDF文件并启用标注添加功能扁平化

React实现原生APP切换效果

《React实现原生APP切换效果》最近需要使用Hybrid的方式开发一个APP,交互和原生APP相似并且需要IM通信,本文给大家介绍了使用React实现原生APP切换效果,文中通过代码示例讲解的非常... 目录背景需求概览技术栈实现步骤根据 react-router-dom 文档配置好路由添加过渡动画使用

SpringBoot如何访问jsp页面

《SpringBoot如何访问jsp页面》本文介绍了如何在SpringBoot项目中进行Web开发,包括创建项目、配置文件、添加依赖、控制层修改、测试效果以及在IDEA中进行配置的详细步骤... 目录SpringBoot如何访问JSP页python面简介实现步骤1. 首先创建的项目一定要是web项目2. 在

使用Python实现生命之轮Wheel of life效果

《使用Python实现生命之轮Wheeloflife效果》生命之轮Wheeloflife这一概念最初由SuccessMotivation®Institute,Inc.的创始人PaulJ.Meyer... 最近看一个生命之轮的视频,让我们珍惜时间,因为一生是有限的。使用python创建生命倒计时图表,珍惜时间