当前位置:网站首页>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" />
边栏推荐
- LeetCode 497(C#)
- Siggraph 2022 best technical paper award comes out! Chen Baoquan team of Peking University was nominated for honorary nomination
- 电脑无法加域,ping域名显示为公网IP,这是什么问题?怎么解决?
- MySQL usage notes 1
- DNS series (I): why does the updated DNS record not take effect?
- 【信息安全法律法規】複習篇
- toast会在程序界面上显示一个简单的提示信息
- redis主从、哨兵主备切换搭建一步一步图解实现
- 让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展
- 邮件服务器被列入黑名单,如何快速解封?
猜你喜欢
Biped robot controlled by Arduino
自定义View必备知识,Android研发岗必问30+道高级面试题
serachview的功能和用法
textSwitch文本切换器的功能和用法
NeRF:DeepFake的最终替代者?
使用popupwindow創建对话框风格的窗口
命令模式 - Unity
Skimage learning (2) -- RGB to grayscale, RGB to HSV, histogram matching
Lex & yacc of Pisa proxy SQL parsing
Sator推出Web3游戏“Satorspace” ,并上线Huobi
随机推荐
Nerf: the ultimate replacement for deepfake?
Sator a lancé le jeu web 3 "satorspace" et a lancé huobi
第3章业务功能开发(安全退出)
actionBar 导航栏学习
Linux 安装mysql8.X超详细图文教程
The top of slashdata developer tool is up to you!!!
centos7安装mysql笔记
使用 xml资源文件定义菜单
Repair method of firewall system crash and file loss, material cost 0 yuan
A tour of grpc:03 - proto serialization / deserialization
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
[source code interpretation] | source code interpretation of livelistenerbus
What is cloud computing?
命令模式 - Unity
邮件服务器被列入黑名单,如何快速解封?
SlashData开发者工具榜首等你而定!!!
2021-06-28
【源码解读】| LiveListenerBus源码解读
第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
使用popupwindow創建对话框风格的窗口