private void addViews() {
        try {
            if ( mViewPager == null || mViewPager.getAdapter() == null || mViewPager.getAdapter().getCount() == 0 ) return;
            removeAllViews();
            AppCompatRadioButton firstItem = new AppCompatRadioButton(getContext());
            firstItem.setText("");
            firstItem.setButtonDrawable(mButtonDrawable.getConstantState().newDrawable());
            ViewPagerIndicator.LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            firstItem.setLayoutParams(params);
            firstItem.setClickable(false);
            addView(firstItem);
            for ( int i=1; i<mViewPager.getAdapter().getCount(); i++ ) {
                AppCompatRadioButton item = new AppCompatRadioButton(getContext());
                item.setText("");
                item.setButtonDrawable(mButtonDrawable.getConstantState().newDrawable());
                params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                params.setMargins(mItemDividerWidth, 0, 0, 0);
                item.setLayoutParams(params);
                item.setClickable(false);
                addView(item);
            }
            check(firstItem.getId());
        } catch(Exception e) {
            Log.e(TAG, getMessageFor(e));
        }
    }
private void addViews() {
        try {
            if ( mViewPager == null || mViewPager.getAdapter() == null || mViewPager.getAdapter().getCount() == 0 ) return;
            removeAllViews();
            AppCompatRadioButton firstItem = new AppCompatRadioButton(getContext());
            firstItem.setText("");
            firstItem.setButtonDrawable(mButtonDrawable.getConstantState().newDrawable());
            ViewPagerIndicator.LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            firstItem.setLayoutParams(params);
            firstItem.setClickable(false);
            addView(firstItem);
            for ( int i=1; i<mViewPager.getAdapter().getCount(); i++ ) {
                AppCompatRadioButton item = new AppCompatRadioButton(getContext());
                item.setText("");
                item.setButtonDrawable(mButtonDrawable.getConstantState().newDrawable());
                params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                params.setMargins(mItemDividerWidth, 0, 0, 0);
                item.setLayoutParams(params);
                item.setClickable(false);
                addView(item);
            }
            check(firstItem.getId());
        } catch(Exception e) {
            Log.e(TAG, getMessageFor(e));
        }
    }
private void addViews ( ) { try { if ( mViewPager == null || mViewPager . getAdapter ( ) == null || mViewPager . getAdapter ( ) . getCount ( ) == 0 ) return ; removeAllViews ( ) ; AppCompatRadioButton firstItem = new AppCompatRadioButton ( getContext ( ) ) ; firstItem . setText ( "" ) ; firstItem . setButtonDrawable ( mButtonDrawable . getConstantState ( ) . newDrawable ( ) ) ; ViewPagerIndicator . LayoutParams params = new LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ; firstItem . setLayoutParams ( params ) ; firstItem . setClickable ( false ) ; addView ( firstItem ) ; for ( int i = 1 ; i < mViewPager . getAdapter ( ) . getCount ( ) ; i ++ ) { AppCompatRadioButton item = new AppCompatRadioButton ( getContext ( ) ) ; item . setText ( "" ) ; item . setButtonDrawable ( mButtonDrawable . getConstantState ( ) . newDrawable ( ) ) ; params = new LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ; params . setMargins ( mItemDividerWidth , 0 , 0 , 0 ) ; item . setLayoutParams ( params ) ; item . setClickable ( false ) ; addView ( item ) ; } check ( firstItem . getId ( ) ) ; } catch ( Exception e ) { Log . e ( TAG , getMessageFor ( e ) ) ; } }
Add page indicators based on the attached ViewPager
Add page indicators based on the attached ViewPager