r-cohen / DiscreteScrollViewIndicator

A page indicator for DiscreteScrollView Android component
Apache License 2.0
2 stars 1 forks source link

Indicator is not showing by adding this file #3

Closed Pbansal09 closed 1 year ago

Pbansal09 commented 3 years ago

I have added this library. Data is displayed in horizontal way. I want to add circular indicator. For this I added DiscreteScrollViewIndicator file in our project and added piece of code which is required, but indicator is not shown.

// Java Code

        binding.picker.setOrientation(DSVOrientation.HORIZONTAL);
        infiniteAdapter = InfiniteScrollAdapter.wrap(adapter);

    binding.picker.setAdapter(infiniteAdapter);

    binding.picker.setItemTransitionTimeMillis(150);
    binding.picker.setItemTransformer(new ScaleTransformer.Builder()
            .setMinScale(0.8f)
            .build());

viewModel.getData();

    float DP = Resources.getSystem().getDisplayMetrics().density;
    DiscreteScrollViewIndicator pageIndicator = DiscreteScrollViewIndicator.Builder(binding.picker)
            .setColorActive(R.color.green_error)
            .setColorInactive((R.color.red_error))
            .setIndicatorStrokeWidth(4 * DP)
            .setIndicatorItemPadding(10 * DP)
            .align(DiscreteScrollViewIndicator.Alignment.PARENT_TOP)
            .matchParentWidth();
    binding.picker.addItemDecoration(pageIndicator);
    pageIndicator.setItemsCount(adapter.getItemCount());
raphael-dario commented 3 years ago

@Pbansal09 how many items are in the adapter?

r-cohen commented 1 year ago

closing this, since no response from info requested.