Giter VIP home page Giter VIP logo

Comments (4)

zhpanvip avatar zhpanvip commented on June 9, 2024

可以贴下代码么

from bannerviewpager.

zhukai78 avatar zhukai78 commented on June 9, 2024

1、
(banner_view as BannerViewPager<Any, ImageResourceViewHolder>)
.setIndicatorMargin(0, 0, 0, BannerUtils.dp2px(10f))
.setIndicatorGravity(IndicatorGravity.CENTER)
.setAutoPlay(true)
.setPageMargin(88)
// .setRoundCorner(24)
.setPageStyle(PageStyle.MULTI_PAGE_OVERLAP)
// .setIndicatorStyle(IndicatorStyle.ROUND_RECT)
// .setIndicatorRadius(32)
.setInterval(5000)
.setIndicatorSlideMode(IndicatorSlideMode.SMOOTH)
.setHolderCreator{( ImageResourceViewHolder(24))}
.setCanLoop(true)
.create(imgs)

2、
class ImageResourceViewHolder(private val roundCorner: Any?) : ViewHolder<Any?> {
private val roundedCorners = RoundedCorners(roundCorner as Int)

private val options = RequestOptions.bitmapTransform(roundedCorners)
override fun getLayoutId(): Int {
    return R.layout.item_banner_page
}
override fun onBind(itemView: View, data: Any?, position: Int, size: Int) {
    val imageView = itemView.findViewById<CornerImageView>(R.id.banner_image)
    imageView.scaleType=ImageView.ScaleType.FIT_XY

// imageView.setImageResource(data!! as Int)
// 通过RequestOptions扩展功能
// 加载图片
GlideApp.with(JtRobotApplication.instance)
.load(data)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.dontAnimate()
.apply(options)
.into(imageView)
imageView.setRoundCorner(roundCorner as Int)

        }

}

from bannerviewpager.

zhpanvip avatar zhpanvip commented on June 9, 2024

没有问题呀?Overlap状态下左右两边被上边覆盖了一部分,本来就不会显示圆角的。

from bannerviewpager.

zhukai78 avatar zhukai78 commented on June 9, 2024

确实是因为覆盖了。。

from bannerviewpager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.