当前位置:网站首页>图片旋转移动缩放渐变
图片旋转移动缩放渐变
2022-06-24 20:17:00 【我与c语言不共戴天】
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:onClick="yidong" android:text="移动"/> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:onClick="suofang" android:text="缩放"/> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:onClick="xuanzhuang" android:text="旋转"/> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:onClick="jianbian" android:text="渐变"/> </LinearLayout> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="10dp" android:src="@drawable/ab" /> </LinearLayout> java package com.commerce.my; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView =findViewById(R.id.imageView); } public void yidong(View view) { Animation translate= AnimationUtils.loadAnimation(this,R.anim.translate_animation); imageView.startAnimation(translate); } public void suofang(View view) { Animation scale= AnimationUtils.loadAnimation(this,R.anim.scale_animation); imageView.startAnimation(scale); } public void xuanzhuang(View view) { Animation rotate= AnimationUtils.loadAnimation(this,R.anim.rotate_animation); imageView.startAnimation(rotate); } public void jianbian(View view) { Animation alpha= AnimationUtils.loadAnimation(this,R.anim.alpha_animation); imageView.startAnimation(alpha); } } 平移 <?xml version="1.0" encoding="utf-8" ?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:toXDelta="100" android:toYDelta="300"> </translate> 缩放 <?xml version="1.0" encoding="utf-8" ?><scale xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" android:fromXScale="0.5" android:fromYScale="0.5" android:interpolator="@android:anim/accelerate_interpolator" android:pivotX="50%" android:pivotY="50%" android:toXScale="2.0" android:toYScale="2.0" > </scale> 旋转 <?xml version="1.0" encoding="utf-8" ?><rotate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="1" android:repeatMode="reverse" android:duration="1000" > </rotate> 渐变 <?xml version="1.0" encoding="utf-8" ?><alpha xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromAlpha="1.0" android:repeatMode="reverse" android:repeatCount="infinite" android:interpolator="@android:anim/linear_interpolator" android:toAlpha="0.0" />
边栏推荐
- JMeter socket connection sends data
- 2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
- Using tcp/udp tools to debug the yeelight ribbon
- 断言(assert)的用法
- Use and click of multitypeadapter in recycleview
- Mobile security tool apktool
- Technologie des fenêtres coulissantes en octets dans la couche de transmission
- 智能合约安全审计入门篇 —— delegatecall (2)
- Usage of assert
- adb shell getevent
猜你喜欢
Using tcp/udp tools to debug the yeelight ribbon
【Redis实现秒杀业务③】超卖问题之乐观锁具体实现
How to quickly open traffic master for wechat applet
Preliminary understanding of qtoolbutton
I 刷题 I — 复制带随机指针的链表
2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
Syntax highlighting of rich text
[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly
The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products
Binder mechanism and Aidl communication example
随机推荐
QT (36) -rapidjson parsing nested JSON
Mobile security tool apktool
ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
A small crawler program written by beginners
移动安全工具-jarsigner
A plug-in framework for implementing registration free and login verification with hook technology
How to reduce the font size of custom controls (optimize the round dot progress bar)
Use of navigation and navigationui
Tiktok wallpaper applet v1.0.2 function, new arrival function
I 刷题 I — 复制带随机指针的链表
2021-09-12
Add information on the left and add parts on the right of the status bar
Rich text tables, lists, pictures
How to quickly open traffic master for wechat applet
热力图展示相关矩阵
Realization of MNIST handwritten numeral recognition
实现mnist手写数字识别
I'd like to ask how to open an account at industrial securities? Is it safe to open a stock account through the link
[microservices sentinel] cluster link | microservices cluster environment construction
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版