From 4276af4cbbb4fcd996946d13e9eca5a1ed40f165 Mon Sep 17 00:00:00 2001 From: Sung Hyun Date: Fri, 3 Jul 2020 16:27:39 -0400 Subject: [PATCH] Updated CarouselView class Updated CarouselView class --- .../java/com/sung2063/sliders/carousel/CarouselView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sliders/src/main/java/com/sung2063/sliders/carousel/CarouselView.java b/Sliders/src/main/java/com/sung2063/sliders/carousel/CarouselView.java index 78d66f2..3073605 100644 --- a/Sliders/src/main/java/com/sung2063/sliders/carousel/CarouselView.java +++ b/Sliders/src/main/java/com/sung2063/sliders/carousel/CarouselView.java @@ -89,7 +89,6 @@ protected void init() { // Setup Layout setupLayoutDirection(carouselHandler.getScrollDirection()); setupSlideNumber(carouselHandler.isShowingSlideNumber()); - addView(rootLayout); // Add layout to the root layout } @@ -119,6 +118,9 @@ private void repositioningVerticalTab() { */ private void setupLayoutDirection(int layoutDirection) { + if (rootLayout != null) + removeView(rootLayout); // Remove layout first + LayoutInflater inflater = LayoutInflater.from(context); if (layoutDirection == CarouselHandler.CAROUSEL_HORIZONTAL_DIRECTION) { // Scroll horizontally @@ -135,6 +137,7 @@ private void setupLayoutDirection(int layoutDirection) { tvPageNum = (TextView) rootLayout.findViewById(R.id.tv_slide_num); pbLayoutLoader = (ProgressBar) rootLayout.findViewById(R.id.pb_layout_loader); } + addView(rootLayout); // Add layout to the root layout }