當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.VISIBLE屬性代碼示例

本文整理匯總了Java中android.widget.TextView.VISIBLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextView.VISIBLE屬性的具體用法?Java TextView.VISIBLE怎麽用?Java TextView.VISIBLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.VISIBLE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

public void update(RecyclerView referenceList, float dx, float dy) {
    if (indexList != null && indexList.getChildCount() > 2) {
        show();
        updatePosBasedOnReferenceList(referenceList);

        View firstVisibleView = indexList.getChildAt(0);
        View secondVisibleView = indexList.getChildAt(1);


        TextView firstRowIndex = (TextView) firstVisibleView.findViewById(R.id.section_title);
        TextView secondRowIndex = (TextView) secondVisibleView.findViewById(R.id.section_title);

        int visibleRange = indexList.getChildCount();
        int actual = indexList.getChildPosition(firstVisibleView);
        int next = actual + 1;
        int last = actual + visibleRange;

        Drawable drawable = activity.getResources().getDrawable(R.drawable.circle_white_bg);
        int backGroundColor = ToolbarContentTintHelper.toolbarTitleColor(activity, ThemeStore.primaryColor(activity));
        stickyIndex.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(backGroundColor)));
        drawable.setColorFilter(backGroundColor, PorterDuff.Mode.SRC_IN);
        stickyIndex.setBackground(drawable);

        // RESET STICKY LETTER INDEX
        stickyIndex.setText(String.valueOf(getIndexContext(firstRowIndex)).toUpperCase());
        stickyIndex.setVisibility(TextView.VISIBLE);
        ViewCompat.setAlpha(firstRowIndex, 1);

        if (dy > 0) {
            // USER SCROLLING DOWN THE RecyclerView
            if (next <= last) {
                if (isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, (1 - (Math.abs(ViewCompat.getY(firstVisibleView)) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    firstRowIndex.setVisibility(TextView.INVISIBLE);
                    stickyIndex.setVisibility(TextView.VISIBLE);
                }
            }
        } else if (dy < 0) {
            // USER IS SCROLLING UP THE RecyclerVIew
            if (next <= last) {
                // RESET FIRST ROW STATE
                firstRowIndex.setVisibility(TextView.INVISIBLE);
                if ((isHeader(firstRowIndex, secondRowIndex) || (getIndexContext(firstRowIndex) != getIndexContext(secondRowIndex))) && isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, 1 - (Math.abs(ViewCompat.getY(firstVisibleView) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    secondRowIndex.setVisibility(TextView.INVISIBLE);
                }
            }
        }

        if (stickyIndex.getVisibility() == TextView.VISIBLE) {
            firstRowIndex.setVisibility(TextView.INVISIBLE);
        }
    } else {
        hide();
    }
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:64,代碼來源:IndexLayoutManager.java

示例2: update

public void update(RecyclerView referenceList, float dx, float dy) {
    if (indexList != null && indexList.getChildCount() > 2) {
        show();
        //updatePosBasedOnReferenceList(referenceList);

        View firstVisibleView = indexList.getChildAt(0);
        View secondVisibleView = indexList.getChildAt(1);


        TextView firstRowIndex = (TextView) firstVisibleView.findViewById(R.id.section_title);
        TextView secondRowIndex = (TextView) secondVisibleView.findViewById(R.id.section_title);

        int visibleRange = indexList.getChildCount();
        int actual = indexList.getChildPosition(firstVisibleView);
        int next = actual + 1;
        int last = actual + visibleRange;

        // RESET STICKY LETTER INDEX
        stickyIndex.setText(String.valueOf(getIndexContext(firstRowIndex)).toUpperCase());
        stickyIndex.setVisibility(TextView.VISIBLE);
        ViewCompat.setAlpha(firstRowIndex, 1);

        if (dy > 0) {
            // USER SCROLLING DOWN THE RecyclerView
            if (next <= last) {
                if (isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, (1 - (Math.abs(ViewCompat.getY(firstVisibleView)) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    firstRowIndex.setVisibility(TextView.INVISIBLE);
                    stickyIndex.setVisibility(TextView.VISIBLE);
                }
            }
        } else if (dy < 0) {
            // USER IS SCROLLING UP THE RecyclerVIew
            if (next <= last) {
                // RESET FIRST ROW STATE
                firstRowIndex.setVisibility(TextView.INVISIBLE);
                if ((isHeader(firstRowIndex, secondRowIndex) || (getIndexContext(firstRowIndex) != getIndexContext(secondRowIndex))) && isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, 1 - (Math.abs(ViewCompat.getY(firstVisibleView) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    secondRowIndex.setVisibility(TextView.INVISIBLE);
                }
            }
        }

        if (stickyIndex.getVisibility() == TextView.VISIBLE) {
            firstRowIndex.setVisibility(TextView.INVISIBLE);
        }
    } else {
        hide();
    }
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:58,代碼來源:IndexLayoutManager.java


注:本文中的android.widget.TextView.VISIBLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。