android.widget.TextView#setScaleY ( )源码实例Demo

下面列出了android.widget.TextView#setScaleY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ZoomHeaderViewPager   文件: ViewPagerHeader.java
private TextView createHeaderItem(int position, String headerText) {

        TextView header = new TextView(getContext());
        LayoutParams linearParams = new LayoutParams(headerWidth / headerPerView, LayoutParams.WRAP_CONTENT);
        header.setLayoutParams(linearParams);

        header.setScaleX(textViewAttr.getHvMinScale());
        header.setScaleY(textViewAttr.getHvMinScale());
        header.setAlpha(textViewAttr.getHvTextAlpha());
        header.setTextColor(textViewAttr.getHvTextColor());
        header.setPadding(0, (int) textViewAttr.getHvPadding(), 0, (int) textViewAttr.getHvPadding());

        header.setMaxLines(1);
        header.setGravity(Gravity.CENTER);
        header.setEllipsize(TextUtils.TruncateAt.END);
        header.setText(headerText);
        header.setTextSize(TypedValue.COMPLEX_UNIT_PX, textViewAttr.getHvTextSize());

        textViews[position] = header;

        return header;
    }
 
源代码2 项目: BottomNavigation   文件: BadgeItem.java
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public T show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            textView.setScaleX(0);
            textView.setScaleY(0);
            textView.setVisibility(View.VISIBLE);
            ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
            animatorCompat.cancel();
            animatorCompat.setDuration(mAnimationDuration);
            animatorCompat.scaleX(1).scaleY(1);
            animatorCompat.setListener(null);
            animatorCompat.start();
        } else {
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setVisibility(View.VISIBLE);
        }
    }
    return getSubInstance();
}
 
源代码3 项目: gdk-apidemo-sample   文件: TouchpadView.java
/**
 * Moves the finger trace associated with the specified pointer id to a new location in the
 * view.
 *
 * @param pointerId the pointer id of the finger trace to move
 * @param point the new location of the finger trace
 */
private void moveFingerTrace(int pointerId, float x, float y) {
    TextView fingerTraceView = mFingerTraceViews[pointerId];

    // Cancel any current animations on the view and bring it back to full opacity.
    fingerTraceView.animate().cancel();
    fingerTraceView.setScaleX(1.0f);
    fingerTraceView.setScaleY(1.0f);
    fingerTraceView.setAlpha(1);

    // Reposition the finger trace by updating the layout margins of its view.
    RelativeLayout.LayoutParams lp =
            (RelativeLayout.LayoutParams) fingerTraceView.getLayoutParams();
    int viewX = (int) (x / mTouchpadHardwareWidth * getWidth());
    int viewY = (int) (y / mTouchpadHardwareHeight * getHeight());
    lp.leftMargin = viewX - FINGER_TRACE_SIZE / 2;
    lp.topMargin = viewY - FINGER_TRACE_SIZE / 2;
    fingerTraceView.setLayoutParams(lp);
}
 
源代码4 项目: TelePlus-Android   文件: PasscodeView.java
@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 项目: TelePlus-Android   文件: PasscodeView.java
@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);
}
 
源代码6 项目: JD-Test   文件: BadgeItem.java
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public BadgeItem show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                textView.setScaleX(0);
                textView.setScaleY(0);
            }
            textView.setVisibility(View.VISIBLE);
            ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
            animatorCompat.cancel();
            animatorCompat.setDuration(mAnimationDuration);
            animatorCompat.scaleX(1).scaleY(1);
            animatorCompat.setListener(null);
            animatorCompat.start();
        } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                textView.setScaleX(1);
                textView.setScaleY(1);
            }
            textView.setVisibility(View.VISIBLE);
        }
    }
    return this;
}
 
源代码7 项目: Ruisi   文件: MyBottomTab.java
private void setTabSelect(int from, int to) {
    if (from != -1) {
        ViewGroup tabItemFrom = this.findViewWithTag(from);
        ImageView preImg = (ImageView) tabItemFrom.getChildAt(0);
        TextView preText = (TextView) tabItemFrom.getChildAt(1);
        //pre_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
        preImg.setColorFilter(COLOR_UNSELECT);
        preText.setTextColor(COLOR_UNSELECT);

        preText.setPivotX(preImg.getWidth() / 2);
        preText.setScaleX(1.0f);
        preText.setScaleY(1.0f);
    }

    ViewGroup tabItemTo = this.findViewWithTag(to);
    ImageView toImg = (ImageView) tabItemTo.getChildAt(0);
    TextView toText = (TextView) tabItemTo.getChildAt(1);
    //to_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
    toImg.setImageResource(iconsUnselect[to]);
    toImg.setColorFilter(COLOR_SELECT);
    toText.setTextColor(COLOR_SELECT);

    toText.setPivotX(toText.getWidth() / 2);
    toText.setScaleX(1.08f);
    toText.setScaleY(1.08f);

    refreshDrawableState();
}
 
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, TextView child, View dependency) {
    AppBarLayout appBarLayout = (AppBarLayout) dependency;
    shouldInitProperties(child, appBarLayout);

    int currentScroll = dependency.getBottom();
    float percentage = (float) currentScroll / (float) mMaxScrollAppBar;
    if (percentage < TOOLBAR_SCALE) {
        percentage = TOOLBAR_SCALE;
    }
    child.setScaleY(percentage);
    child.setScaleX(percentage);
    return true;
}
 
源代码9 项目: Telegram-FOSS   文件: PasscodeView.java
@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);
}
 
源代码10 项目: Telegram   文件: PasscodeView.java
@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);
}
 
源代码11 项目: ZoomHeaderViewPager   文件: ViewPagerHeader.java
private void updateTextView(TextView textView, float scale, float alpha, int color) {
    textView.setScaleX(scale);
    textView.setScaleY(scale);
    textView.setAlpha(alpha);
    textView.setTextColor(color);
}
 
 方法所在类
 同类方法