private StateListDrawable getSelectorDrawable ( ) { StateListDrawable d = null ; try { d = new StateListDrawable ( ) ; ShapeDrawable selectedDrawable = new ShapeDrawable ( new OvalShape ( ) ) ; selectedDrawable . getPaint ( ) . setColor ( mItemSelectedColor ) ; selectedDrawable . setIntrinsicHeight ( mItemRadius * 2 ) ; selectedDrawable . setIntrinsicWidth ( mItemRadius * 2 ) ; ShapeDrawable unselectedDrawable = new ShapeDrawable ( new OvalShape ( ) ) ; unselectedDrawable . getPaint ( ) . setColor ( mItemUnselectedColor ) ; unselectedDrawable . setIntrinsicHeight ( mItemRadius * 2 ) ; unselectedDrawable . setIntrinsicWidth ( mItemRadius * 2 ) ; d . addState ( new int [ ] { android . R . attr . state_checked } , selectedDrawable ) ; d . addState ( new int [ ] { } , unselectedDrawable ) ; } catch ( Exception e ) { Log . e ( TAG , getMessageFor ( e ) ) ; } return d ; }
Create a StateListDrawable for the pager indicator