当前位置:网站首页>Functions and usage of viewflipper
Functions and usage of viewflipper
2022-07-07 17:36:00 【XLMN】
viewflipper The function and usage of
viewflipper Inherited viewanimator, Callable addview(view v) Add multiple components once to viewflipper After adding multiple components ,viewflipper You can use animation to control the switching effect between multiple components
public class MainActivity extends Activity {
private ViewFlipper vf;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.viewflipper);
vf = (ViewFlipper) findViewById(R.layout.viewflipper);
}
public void prev(View view) {
// TODO Auto-generated method stub
vf.setInAnimation(this, android.R.anim.slide_in_left);
vf.setOutAnimation(this, android.R.anim.slide_out_right);
// Show previous component
vf.showPrevious();
// Stop autoplay
vf.stopFlipping();
}
public void next(View view) {
// TODO Auto-generated method stub
vf.setInAnimation(this, android.R.anim.slide_in_left);
vf.setOutAnimation(this, android.R.anim.slide_out_right);
// Show the next
vf.showNext();
// Stop autoplay
vf.stopFlipping();
}
public void auto(View view) {
// TODO Auto-generated method stub
vf.setInAnimation(this, android.R.anim.slide_in_left);
vf.setOutAnimation(this,android.R.anim.slide_out_right);
// Start autoplay
vf.startFlipping();
}
}
<?xml version="1.0" encoding="utf-8"?><!-- android:flipInterval="1000" It means setting up every one of them View Time shown ; -->
<ViewFlipper
android:id="@+id/viewflipper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:flipInterval="1000" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/love" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/mia" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/mia10" />
</ViewFlipper>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:onClick="prev"
android:text="&lt" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:onClick="auto"
android:text=" Auto play " />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:onClick="next"
android:text="&gt" />

边栏推荐
- 浅谈 Apache Doris FE 处理查询 SQL 源码解析
- LeetCode 648(C#)
- 第2章搭建CRM项目开发环境(数据库设计)
- 麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
- The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
- Devops' operational and commercial benefits Guide
- rpcms获取指定分类下的文章的方法
- DevOps 的运营和商业利益指南
- Nerf: the ultimate replacement for deepfake?
- [source code interpretation] | source code interpretation of livelistenerbus
猜你喜欢

第3章业务功能开发(实现记住账号密码)

DatePickerDialog和trimepickerDialog
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism

【分布式理论】(二)分布式存储

麒麟信安加入宁夏商用密码协会

科普达人丨一文弄懂什么是云计算?

With the latest Alibaba P7 technology system, mom doesn't have to worry about me looking for a job anymore

管理VDI的几个最佳实践

Leetcode brush questions day49

toast会在程序界面上显示一个简单的提示信息
随机推荐
NeRF:DeepFake的最终替代者?
服务器彻底坏了,无法修复,如何利用备份无损恢复成虚拟机?
邮件服务器被列入黑名单,如何快速解封?
[Fantan] how to design a test platform?
Matplotlib绘制三维图形
第2章搭建CRM项目开发环境(数据库设计)
On Apache Doris Fe processing query SQL source code analysis
alertDialog創建对话框
LeetCode 497(C#)
Mrs offline data analysis: process OBS data through Flink job
mysql官网下载:Linux的mysql8.x版本(图文详解)
TabHOST 选项卡的功能和用法
【可信计算】第十一次课:TPM密码资源管理(三) NV索引与PCR
使用 xml资源文件定义菜单
《世界粮食安全和营养状况》报告发布:2021年全球饥饿人口增至8.28亿
【饭谈】如何设计好一款测试平台?
第3章业务功能开发(安全退出)
【重新理解通信模型】Reactor 模式在 Redis 和 Kafka 中的应用
Proxmox VE重装后,如何无损挂载原有的数据盘?
本周小贴士#136:无序容器