Java Code Examples for android.widget.TextView#setScaleX()
The following examples show how to use
android.widget.TextView#setScaleX() .
These examples are extracted from open source projects.
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 Project: ZoomHeaderViewPager File: ViewPagerHeader.java License: 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 Project: android-proguards File: HomeActivity.java License: Apache License 2.0 | 6 votes |
private void animateToolbar() { // this is gross but toolbar doesn't expose it's children to animate them :( View t = toolbar.getChildAt(0); if (t != null && t instanceof TextView) { TextView title = (TextView) t; // fade in and space out the title. Animating the letterSpacing performs horribly so // fake it by setting the desired letterSpacing then animating the scaleX ¯\_(ツ)_/¯ title.setAlpha(0f); title.setScaleX(0.8f); title.animate() .alpha(1f) .scaleX(1f) .setStartDelay(300) .setDuration(900) .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)); } }
Example 3
Source Project: BottomNavigation File: BadgeItem.java License: 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 4
Source Project: gdk-apidemo-sample File: TouchpadView.java License: 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 5
Source Project: TelePlus-Android File: PasscodeView.java License: 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 Project: TelePlus-Android File: PasscodeView.java License: 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 7
Source Project: JD-Test File: BadgeItem.java License: 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 8
Source Project: Ruisi File: MyBottomTab.java License: 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 9
Source Project: CoordinatorLayoutSample File: MatchScoreBehavior.java License: 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 10
Source Project: Telegram-FOSS File: PasscodeView.java License: 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 Project: Telegram File: PasscodeView.java License: 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 12
Source Project: ZoomHeaderViewPager File: ViewPagerHeader.java License: 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); }