如何在 CirclePageIndicator 上设置项目限制? [英] How to set a limit of items on CirclePageIndicator?

查看:20
本文介绍了如何在 CirclePageIndicator 上设置项目限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自 ViewPagerIndicator 库的 ViewPagerCirclePageIndicator 来显示下面带有一些圆圈的图像,但圆圈是溢出布局,像这样:

I'm using a ViewPager and a CirclePageIndicator, from ViewPagerIndicator lib, to show images with some circles below, but the circles are overflowing the layout, like this:

有什么方法可以定义圆的最大限制?保持这样:

There's some way to define a maximum limit of circles? To keep it like this:

推荐答案

PageIndicatorView 库使限制数量指标更容易.我用它代替了 ViewPageIndicator,并使用

The PageIndicatorView library makes restricting the number of indicators easier. I used it instead of ViewPageIndicator, and restricted the number of indicators to the maximum that could fit on the screen with

  int maximumIndicators = 24;
  if (mMarkers.size() > maximumIndicators ){
      mPageIndicator.setCount(maximumIndicators);
      }

这篇关于如何在 CirclePageIndicator 上设置项目限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆