当前位置:网站首页>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" />
边栏推荐
- The mail server is listed in the blacklist. How to unblock it quickly?
- On Apache Doris Fe processing query SQL source code analysis
- 责任链模式 - Unity
- Matplotlib绘图界面设置
- 第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
- 专精特新软件开发类企业实力指数发布,麒麟信安荣誉登榜
- Mysql 索引命中级别分析
- Flash build API service
- Sator推出Web3游戏“Satorspace” ,并上线Huobi
- 【网络攻防原理与技术】第5章:拒绝服务攻击
猜你喜欢
随机推荐
【重新理解通信模型】Reactor 模式在 Redis 和 Kafka 中的应用
状态模式 - Unity(有限状态机)
本周小贴士#135:测试约定而不是实现
Flash build API service
LeetCode 535(C#)
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
【网络攻防原理与技术】第7章:口令攻击技术 第8章:网络监听技术
命令模式 - Unity
How to mount the original data disk without damage after the reinstallation of proxmox ve?
L1-019 谁先倒(Lua)
LeetCode 648(C#)
99% of users often make mistakes in power Bi cloud reports
Leetcode brush questions day49
第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
Sator推出Web3遊戲“Satorspace” ,並上線Huobi
邮件服务器被列入黑名单,如何快速解封?
本周小贴士#134:make_unique与私有构造函数
L1-025 正整数A+B(Lua)
Matplotlib绘制三维图形
Smart logistics platform: make overseas warehouses smarter