Closed jamal-wia closed 3 years ago
val dotsIndicator = DotsIndicator(parent.context).apply { id = View.generateViewId() layoutParams = LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT ).apply { setMargins(0, 8.toDpInt(), 0, 0) } setHorizontalGravity(Gravity.CENTER) setViewPager2(viewPager) }
But don't display anything
I can resolve this problem. You need call in post { }
val dotsIndicator = DotsIndicator(parent.context).apply { id = View.generateViewId() layoutParams = LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT ).apply { setMargins(0, 8.toDpInt(), 0, 0) } setHorizontalGravity(Gravity.CENTER) setViewPager2(viewPager) }
But don't display anything