Java Code Examples for android.widget.TextView#setScaleY()
The following examples show how to use
android.widget.TextView#setScaleY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewPagerHeader.java From ZoomHeaderViewPager with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: BadgeItem.java From BottomNavigation with Apache License 2.0 | 6 votes |
/** * @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(); }
Example 3
Source File: TouchpadView.java From gdk-apidemo-sample with Apache License 2.0 | 6 votes |
/** * 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); }
Example 4
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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); }
Example 5
Source File: PasscodeView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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); }
Example 6
Source File: BadgeItem.java From JD-Test with Apache License 2.0 | 5 votes |
/** * @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; }
Example 7
Source File: MyBottomTab.java From Ruisi with Apache License 2.0 | 5 votes |
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(); }
Example 8
Source File: MatchScoreBehavior.java From CoordinatorLayoutSample with Apache License 2.0 | 5 votes |
@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; }
Example 9
Source File: PasscodeView.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@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); }
Example 10
Source File: PasscodeView.java From Telegram with GNU General Public License v2.0 | 5 votes |
@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); }
Example 11
Source File: ViewPagerHeader.java From ZoomHeaderViewPager with Apache License 2.0 | 4 votes |
private void updateTextView(TextView textView, float scale, float alpha, int color) { textView.setScaleX(scale); textView.setScaleY(scale); textView.setAlpha(alpha); textView.setTextColor(color); }