本文整理匯總了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;
}
}
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}
}