ViewPager2-Examples icon indicating copy to clipboard operation
ViewPager2-Examples copied to clipboard

When coming first time in app then dot indicator is not showing

Open tusharojhabacancy opened this issue 4 years ago • 1 comments

When app get started, view pager is showing but dot indicator is not showing. When we scrolled view pager then dot indicator is showing, but first time having issue. Can you give any solution or advice

tusharojhabacancy avatar Apr 16 '21 12:04 tusharojhabacancy

I fixed by doing the dot indicator logic inside layoutDots.post {}

layoutDots.post {
            layoutDots.removeAllViews()
            for (i in dots.indices) {
                dots[i] = TextView(this)
                dots[i]?.text = Html.fromHtml("•")
                dots[i]?.textSize = 35f
                dots[i]?.setTextColor(colorsInactive)
                layoutDots.addView(dots[i])
            }
            if (dots.isNotEmpty()) {
                dots[currentPage]?.setTextColor(colorsActive)
            }
        }

ow-ro avatar Dec 18 '21 06:12 ow-ro