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


Java TextView.setTranslationY方法代碼示例

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


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

示例1: onNestedPreScroll

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull TextView child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
    super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
    if (target instanceof RecyclerView) {
        RecyclerView list = (RecyclerView) target;
        //列表第一個全部可見Item的位置
        int pos = ((LinearLayoutManager) list.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
        if (pos == 0 && pos < lastPosition) {
            downReach = true;
        }

        if (canScroll(child, dy) && pos == 0) {
            float finalY = child.getTranslationY() - dy;
            if (finalY < -child.getHeight()) {
                finalY = -child.getHeight();
                upReach = true;
            } else if (finalY > 0) {
                finalY = 0;
            }
            child.setTranslationY(finalY);
            consumed[1] = dy;
        }
        lastPosition = pos;
    }
}
 
開發者ID:Othershe,項目名稱:BehaviorDemo,代碼行數:26,代碼來源:SampleHeaderBehavior.java

示例2: showPromptText

import android.widget.TextView; //導入方法依賴的package包/類
private void showPromptText(TextView v) {
	if (currentPrompt == 2) {
		v.setText(getString(R.string.donation_prompt_three));
	} else if (currentPrompt == PAYMENT_STEP) {
		v.setText(getString(R.string.donation_prompt_four));
	} else if (currentPrompt > PAYMENT_STEP) {
		if (donationStep == 0) {
			v.setText(getString(R.string.donation_prompt_nothing));
		} else {
			v.setText(getString(R.string.donation_prompt_donated));
		}
	}


	Interpolator interpolator = new AccelerateDecelerateInterpolator();
	v.setTranslationY((v.getHeight()));
	v.animate().alpha(1f).translationY(0).setDuration(animationDuration).setInterpolator(interpolator).start();
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:19,代碼來源:DonationActivity.java

示例3: doTranslation

import android.widget.TextView; //導入方法依賴的package包/類
private void doTranslation(final TextView title, final int translate) {
    if (orientation == MaterialCalendarView.HORIZONTAL) {
        title.setTranslationX(translate);
    } else {
        title.setTranslationY(translate);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:TitleChanger.java

示例4: onLayout

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    if (dotRunnable != null) {
        AndroidUtilities.cancelRunOnUIThread(dotRunnable);
        dotRunnable = null;
    }
    if (currentAnimation != null) {
        currentAnimation.cancel();
        currentAnimation = null;
    }

    for (int a = 0; a < 4; a++) {
        if (a < stringBuilder.length()) {
            TextView textView = characterTextViews.get(a);
            textView.setAlpha(0);
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setTranslationY(0);
            textView.setTranslationX(getXForTextView(a));

            textView = dotTextViews.get(a);
            textView.setAlpha(1);
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setTranslationY(0);
            textView.setTranslationX(getXForTextView(a));
        } else {
            characterTextViews.get(a).setAlpha(0);
            dotTextViews.get(a).setAlpha(0);
        }
    }
    super.onLayout(changed, left, top, right, bottom);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:34,代碼來源:PasscodeView.java

示例5: doTranslation

import android.widget.TextView; //導入方法依賴的package包/類
private void doTranslation(final TextView title, final int translate) {
    if (orientation == CalendarView2.HORIZONTAL) {
        title.setTranslationX(translate);
    } else {
        title.setTranslationY(translate);
    }
}
 
開發者ID:ptrstovka,項目名稱:calendarview2,代碼行數:8,代碼來源:TitleChanger.java


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