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

边栏推荐
猜你喜欢
随机推荐
TabHOST 选项卡的功能和用法
Enum + Validation 的个人最佳实践 demo 分享
99% 用户在 Power BI 云端报表常犯错误
Jenkins发布uniapp开发的H5遇到的问题
Sator推出Web3遊戲“Satorspace” ,並上線Huobi
How to implement safety practice in software development stage
【饭谈】那些看似为公司着想,实际却很自私的故事 (一:造轮子)
数值 - number(Lua)
【网络攻防原理与技术】第4章:网络扫描技术
SlashData开发者工具榜首等你而定!!!
LeetCode 890(C#)
Matplotlib绘图界面设置
On Apache Doris Fe processing query SQL source code analysis
百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示
Solidity函数学习
With the latest Alibaba P7 technology system, mom doesn't have to worry about me looking for a job anymore
【源码解读】| LiveListenerBus源码解读
本周小贴士#135:测试约定而不是实现
viewflipper的功能和用法
Skimage learning (2) -- RGB to grayscale, RGB to HSV, histogram matching









