AdapterViewFlipper 图片_文字 轮播动画控件,android应用程序开发

本文介绍了如何在Android应用程序中使用AdapterViewFlipper实现文字和图片的轮播效果,包括ImgFlipperAdapter和TextFlipperAdapter的实现,以及布局和动画的设置。同时,提供了相应的布局文件activity_flipper_anim.xml和item_flipper_text.xml的代码片段。
摘要由CSDN通过智能技术生成

}

// 图片轮播
private fun initImgFlipper() {
imgFlipper = findViewById(R.id.img_flipper)
val list = listOf(“http://www.nicesoso.com/test/file/img/test.jpg”, “http://www.nicesoso.com/test/file/img/test_h_1.jpg”,
“http://www.nicesoso.com/test/file/img/test_h_2.jpg”)
imgFlipper?.adapter = ImgFlipperAdapter(this, list)
imgFlipper?.setInAnimation(this, R.animator.img_flipper_in)
preBtn = findViewById(R.id.prev_btn)
nextBtn = findViewById(R.id.next_btn) as Button
autoBtn = findViewById(R.id.auto_btn) as Button

preBtn?.setOnClickListener(this)
nextBtn?.setOnClickListener(this)
autoBtn?.setOnClickListener(this)
}

override fun onClick(v: View?) {
when (v?.id) {
R.id.prev_btn -> {
imgFlipper?.showPrevious()
imgFlipper?.stopFlipping()
}
R.id.next_btn -> {
imgFlipper?.showNext()
imgFlippe

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值