本文整理汇总了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);
}
}