当前位置: 首页 > news >正文

骆驼有没有做网站的公司app试玩网站制作

骆驼有没有做网站的公司,app试玩网站制作,wordpress文章同步国外博客,线上推广员目录 介绍 效果图 代码实现 xml文件 介绍 ValueAnimator是ObjectAnimator的父类#xff0c;它继承自Animator。ValueAnimaotor同样提供了ofInt、ofFloat、ofObject等静态方法#xff0c;传入的参数是动画过程的开始值、中间值、结束值来构造动画对象。可以将ValueAnimator看…目录 介绍 效果图 代码实现 xml文件 介绍 ValueAnimator是ObjectAnimator的父类它继承自Animator。ValueAnimaotor同样提供了ofInt、ofFloat、ofObject等静态方法传入的参数是动画过程的开始值、中间值、结束值来构造动画对象。可以将ValueAnimator看着一个值变化器即在给定的时间内将一个目标值从给定的开始值变化到给定的结束值。 上一篇中我们提到在使用ValueAnimator时通常需要添加一个动画更新的监听器在监听器中能够获取到执行过程中的每一个动画值。 privatevoidstartValueAnimator() {ValueAnimatorvalueAnimator ValueAnimator.ofFloat(0, 1);valueAnimator.setDuration(300);valueAnimator.start();valueAnimator.addUpdateListener(newValueAnimator.AnimatorUpdateListener() {OverridepublicvoidonAnimationUpdate(ValueAnimator animation) {// 动画更新过程中的动画值可以根据动画值的变化来关联对象的属性实现属性动画floatvalue (float) animation.getAnimatedValue();Log.d(ValueAnimator, 动画值 value);}}); }复制代码 ValueAnimator的使用一般会结合更新监听器AnimatorUpdateListener大多数时候是在自定义控件时使用。 我们可以利用ValueAnimator自定义控件实现动画打开关闭效果。 效果图 代码实现 package com.example.animationstudy;import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity;import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.app.ActionBar; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView;public class MainActivity4 extends AppCompatActivity implements View.OnClickListener {Button button;ImageView imageView;TextView textView;boolean isClose true;ValueAnimator animator1;ValueAnimator animator2;LinearLayout.LayoutParams params; //LinearLayout.LayoutParams 是 Android 中用于定义 LinearLayout线性布局中子视图的布局参数的类。它继承自 ViewGroup.MarginLayoutParams 类因此包含了 Margin 相关的属性。////LinearLayout 是一种常用的布局容器可以水平或垂直排列子视图。而 LinearLayout.LayoutParams 则是用于描述子视图在 LinearLayout 中的布局行为例如子视图在父布局中的位置、大小、权重等。int hight;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main4);button (Button) findViewById(R.id.button4);imageView (ImageView) findViewById(R.id.imageView4);textView (TextView) findViewById(R.id.text42);button.setOnClickListener(this);imageView.setOnClickListener(this);textView.post(new Runnable() {Overridepublic void run() {hight textView.getMeasuredHeight();init();}}); //注意在调用 getMeasuredHeight() 方法前TextView 控件必须已经完成布局和测量否则获取到的高度值可能是 0因此在此之前需要确保 TextView 控件已经被添加到父容器中并已经完成了布局和测量。 //这个方法可以确保 TextView 控件完成了布局因为它是通过 post 方法将一个 Runnable 对象发送到主线程的消息队列中并在主线程空闲时执行。在主线程中执行的代码会在 UI 线程的消息循环中得到处理因此可以保证在布局完成后才执行。}public void init(){animator1 isClose ? ValueAnimator.ofFloat(0,180) : ValueAnimator.ofFloat(180,0);animator1.setDuration(500);animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {Overridepublic void onAnimationUpdate(NonNull ValueAnimator valueAnimator) {float value (float) animator1.getAnimatedValue();imageView.setRotation(value);}});animator1.start();params (LinearLayout.LayoutParams) textView.getLayoutParams();animator2 isClose ? ValueAnimator.ofInt(hight,0) : ValueAnimator.ofInt(0,hight);animator2.setDuration(500);animator2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {Overridepublic void onAnimationUpdate(NonNull ValueAnimator valueAnimator) {int value (int) valueAnimator.getAnimatedValue();Log.d(TextView4, onAnimationUpdate: value);params.height value;textView.setLayoutParams(params);}});animator2.addListener(new AnimatorListenerAdapter() {Overridepublic void onAnimationEnd(Animator animation) {super.onAnimationEnd(animation);isClose !isClose;}});animator2.start();}Overridepublic void onClick(View view) {if (view.getId() R.id.button4){init();}if (view.getId() R.id.imageView4){init();}} } xml文件 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:apphttp://schemas.android.com/apk/res-autoxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticaltools:context.MainActivity4Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:idid/button4android:text播放android:layout_gravitycenterandroid:layout_margin20dp/LinearLayoutandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:gravitycenter_verticalTextViewandroid:idid/tetx41android:layout_width0dpandroid:layout_height48dpandroid:layout_weight1android:gravitycenter_verticalandroid:padding8dpandroid:text冥王语录android:layout_marginLeft20dpandroid:textColor#999999android:textSize16sp/ImageViewandroid:idid/imageView4android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_marginRight30dpandroid:srcdrawable/up//LinearLayoutTextViewandroid:idid/text42android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:padding8dpandroid:text 美只不过是一瞬间的感觉只有真实才是永恒的而真实绝不会美爱能创造一切也能毁灭一切。当你用爱保护羊群不受狼的伤害那么对于狼这种爱心就等于毁灭因为他们会因此而活活饿死。这个世界本就如此不是狼死就是羊死不是弱小的狼被饿死就是弱小的羊被咬死。或许这世界太过残酷然而却因此而美丽。android:textColor#999999android:textSize16sp /Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:texthello worldandroid:layout_margin20dpandroid:layout_gravitycenter//LinearLayout 最后的Button没有设置点击事件起到一个造型上的作用 上一篇Android动画三——属性动画-CSDN博客 本文参考Android 动画-CSDN博客
http://wiki.neutronadmin.com/news/120546/

相关文章:

  • 做网站登入见面文字排版都用哪些网站
  • 网站备案花钱么做视频网站要多大的服务器
  • 网站开发公司会计处理qq网页版手机版
  • 商务网站内容维护和管理的范围蒙牛网站建设报价情况
  • 网站图片设计制作网站搜索引擎优化是什么
  • 简述从网站规划的角度常见的网站模式网站开发制作公司排行
  • 合肥快速建站在线咨询在线crm系统功能模块分析
  • 义乌购物网站建设多少钱洛阳信息网
  • 网站备案 谁接入谁负责河北省住房和城乡建设厅网站
  • 梭子手做鱼网站杭州企业推广网站
  • 电子商务企业网站建设实训报告谈谈你在建设主题资源网站时
  • 网站怎么做页面解析跳转珠海公司做网站
  • seo快速排名首页长沙网站优化推广方案
  • 漯河市万金镇网站建设做网站学什么代码
  • 搭建网站多少钱自动提取关键词的软件
  • 食品企业网站建设方案怎么用小旋风网站建设教程
  • 网站模版 之星万方网官网入口
  • 外贸做网站的好处看广告得收益的app
  • 有哪个网站可以查别人做没做过牢吗太原关键词优化服务
  • 网站开发语言怎么查最新国际军事动态和军事战争
  • 免费网站服务器2020wordpress 设置多域名 一个站点
  • 攻略网站的建设如何加快门户网站建设
  • 免费网站建设自助建站建视频网站系统吗
  • 重庆巴南区网站开发公司重庆山艺网站建设
  • 5g云网站建设青岛做网站建设价格
  • 中国建设银行人力资源网站动易网站安装
  • 顺德网站建设包括哪些网站运营管理教材
  • 猎头用什么网站做单最干净在线代理
  • 企业黄页信息查询网aso安卓优化公司
  • 企业网站开发上海韵茵自己的app如何接广告