当前位置:网站首页>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" />

边栏推荐
- SlashData开发者工具榜首等你而定!!!
- DNS 系列(一):为什么更新了 DNS 记录不生效?
- First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
- rpcms获取指定分类下的文章的方法
- LeetCode 515(C#)
- NeRF:DeepFake的最终替代者?
- Nerf: the ultimate replacement for deepfake?
- 策略模式 - Unity
- The computer cannot add a domain, and the Ping domain name is displayed as the public IP. What is the problem? How to solve it?
- 【网络攻防原理与技术】第5章:拒绝服务攻击
猜你喜欢

【网络攻防原理与技术】第1章:绪论

百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示

第3章业务功能开发(用户登录)

麒麟信安中标国网新一代调度项目!

网络攻防复习篇

第2章搭建CRM项目开发环境(搭建开发环境)

【可信计算】第十三次课:TPM扩展授权与密钥管理

Matplotlib绘图界面设置

The top of slashdata developer tool is up to you!!!

With the latest Alibaba P7 technology system, mom doesn't have to worry about me looking for a job anymore
随机推荐
防火墙系统崩溃、文件丢失的修复方法,材料成本0元
【分布式理论】(一)分布式事务
本周小贴士#134:make_unique与私有构造函数
使用Stace排除故障的5种简单方法
智慧物流平台:让海外仓更聪明
Flask build API service SQL configuration file
L1-028 判断素数(Lua)
《世界粮食安全和营养状况》报告发布:2021年全球饥饿人口增至8.28亿
99% 用户在 Power BI 云端报表常犯错误
LeetCode 515(C#)
[video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial
【TPM2.0原理及应用指南】 12、13、14章
管理VDI的几个最佳实践
Flask搭建api服务
How to implement safety practice in software development stage
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展
VSCode关于C语言的3个配置文件
Sator推出Web3遊戲“Satorspace” ,並上線Huobi
What is cloud computing?