Code example for View

Methods: getLayoutParams, setLayoutParams, setVisibility

0
this.mCurrentPage = currentPage;
        // Now show the indicator 
        if (this.mCurrentPage != -1) {
            onPageScrollChange(this.mCurrentPage, 0.0f);
            this.mForegroundBar.setVisibility(View.VISIBLE);
        } 
    } 
 
    /** 
     * Method that change the scroll of the indicator 
     * 
     * @param page The page that is changing 
     * @param scrollOffSet The scroll offset 
     */ 
    public void onPageScrollChange(int page, float scrollOffSet) {
        // Set the new position 
        int lm = ((page * this.mForegroundWidth)
                 + (this.mForegroundWidth == 0 ?
                        0 : 
                        (int)(scrollOffSet * this.mForegroundWidth)));
        RelativeLayout.LayoutParams params =
                (RelativeLayout.LayoutParams)this.mForegroundBar.getLayoutParams();
        params.leftMargin = lm;
        this.mForegroundBar.setLayoutParams(params);
 
        // Reschedule the timer 
        rescheduleDimTimer(); 
        showIndicator(false); 
    }