List of usage examples for android.widget TextView setScaleX
public void setScaleX(float scaleX)
From source file:com.icenler.lib.view.LivingTabsLayout.java
private void setScalePosition(final int position, final float positionOffset, final int oldPosition, final int pendingPosition) { if (!animationRunning) { int newPosition = position; float scale = positionOffset; if (position == oldPosition) { //TODO solve out of bound newPosition = position + 1;/* w w w. ja v a 2s .co m*/ } else { scale = 1 - scale; } if (pendingPosition != -1) { newPosition = pendingPosition; } final LivingTab newTab = tabs.get(newPosition); TextView newTv = newTab.textView; newTv.setScaleY(scale); newTv.setScaleX(scale); ImageView newIv = newTab.iconView; float inversedScale = 1 - scale; newIv.setScaleY(inversedScale); newIv.setScaleX(inversedScale); final LivingTab oldTab = tabs.get(oldPosition); TextView oldTv = oldTab.textView; oldTv.setScaleY(inversedScale); oldTv.setScaleX(inversedScale); ImageView oldIv = oldTab.iconView; oldIv.setScaleY(scale); oldIv.setScaleX(scale); } }
From source file:com.lcc.view.LivingTabsLayout.java
private void setScalePosition(final int position, final float positionOffset, final int oldPosition, final int pendingPosition) { if (!animationRunning) { int newPosition = position; float scale = positionOffset; if (position == oldPosition) { newPosition = position + 1;/*from w ww . j a v a 2 s . c o m*/ } else { scale = 1 - scale; } if (pendingPosition != -1) { newPosition = pendingPosition; } final LivingTab newTab = tabs.get(newPosition); TextView newTv = newTab.textView; newTv.setScaleY(scale); newTv.setScaleX(scale); ImageView newIv = newTab.iconView; float inversedScale = 1 - scale; newIv.setScaleY(inversedScale); newIv.setScaleX(inversedScale); final LivingTab oldTab = tabs.get(oldPosition); TextView oldTv = oldTab.textView; oldTv.setScaleY(inversedScale); oldTv.setScaleX(inversedScale); ImageView oldIv = oldTab.iconView; oldIv.setScaleY(scale); oldIv.setScaleX(scale); } }
From source file:com.github.saiff35.livingtabs.LivingTabsLayout.java
private void setScalePosition(final int position, final float positionOffset, final int oldPosition, final int pendingPosition) { if (!animationRunning) { int newPosition = position; float scale = positionOffset; if (position == oldPosition) { //TODO solve out of bound newPosition = position + 1;//from w w w .jav a 2s .c om } else { scale = 1 - scale; } if (pendingPosition != -1) { newPosition = pendingPosition; } final LivingTab newTab = tabs.get(newPosition); TextView newTv = newTab.textView; newTv.setScaleY(scale); newTv.setScaleX(scale); ImageView newIv = newTab.iconView; float inversedScale = 1 - scale; newIv.setScaleY(inversedScale); newIv.setScaleX(inversedScale); final LivingTab oldTab = tabs.get(oldPosition); TextView oldTv = oldTab.textView; oldTv.setScaleY(inversedScale); oldTv.setScaleX(inversedScale); ImageView oldIv = oldTab.iconView; oldIv.setScaleY(scale); oldIv.setScaleX(scale); } }
From source file:com.icenler.lib.view.LivingTabsLayout.java
@Override public void setupWithViewPager(@NonNull ViewPager viewPager) { final PagerAdapter adapter = viewPager.getAdapter(); DrawableResIconAdapter drawableResIconAdapter = null; DrawableIconAdapter drawableIconAdapter = null; boolean isDrawableResAdapter; if ((isDrawableResAdapter = adapter instanceof DrawableResIconAdapter)) { drawableResIconAdapter = (DrawableResIconAdapter) adapter; } else if (adapter instanceof DrawableIconAdapter) { drawableIconAdapter = (DrawableIconAdapter) adapter; } else {//from w w w . j a v a 2s .c o m throw new IllegalArgumentException( "ViewPager's adapter must implement either DrawableIconAdapter or DrawableResIconAdapter"); } super.setupWithViewPager(viewPager); final int selectedTabPosition = getSelectedTabPosition(); final int count = adapter.getCount(); if (tabs == null) tabs = new ArrayList<>(count); else { tabs.clear(); } for (int i = 0; i < count; ++i) { Tab t = super.getTabAt(i); if (isDrawableResAdapter) t.setIcon(drawableResIconAdapter.getIcon(i)); else t.setIcon(drawableIconAdapter.getIcon(i)); final LivingTab tab = newLivingTab(t); // .setText(adapter.getPageTitle(i)) //.setIcon(icons.get(i)); addTab(tab); if (i != selectedTabPosition) { final TextView textView = tab.textView; textView.setScaleY(SCALE_HIDDEN); textView.setScaleX(SCALE_HIDDEN); } else { final ImageView iconView = tab.iconView; iconView.setScaleY(SCALE_HIDDEN); iconView.setScaleX(SCALE_HIDDEN); } } viewPager.addOnPageChangeListener(new LivingTabsOnPageChangeListener(this)); }
From source file:com.github.saiff35.livingtabs.LivingTabsLayout.java
@Override public void setupWithViewPager(@NonNull ViewPager viewPager) { final PagerAdapter adapter = viewPager.getAdapter(); DrawableResIconAdapter drawableResIconAdapter = null; DrawableIconAdapter drawableIconAdapter = null; boolean isDrawableResAdapter; if ((isDrawableResAdapter = adapter instanceof DrawableResIconAdapter)) { drawableResIconAdapter = (DrawableResIconAdapter) adapter; } else if (adapter instanceof DrawableIconAdapter) { drawableIconAdapter = (DrawableIconAdapter) adapter; } else {/* w w w . ja v a 2s . co m*/ throw new IllegalArgumentException( "ViewPager's adapter must implement either DrawableIconAdapter or DrawableResIconAdapter"); } super.setupWithViewPager(viewPager); final int selectedTabPosition = getSelectedTabPosition(); final int count = adapter.getCount(); if (tabs == null) tabs = new ArrayList<>(count); else { tabs.clear(); } for (int i = 0; i < count; ++i) { Tab t = super.getTabAt(i); if (isDrawableResAdapter) t.setIcon(drawableResIconAdapter.getIcon(i)); else t.setIcon(drawableIconAdapter.getIcon(i)); final LivingTab tab = newLivingTab(t); // .setText(adapter.getPageTitle(i)) //.setIcon(icons.get(i)); addTab(tab); if (i != selectedTabPosition) { final TextView textView = tab.textView; textView.setScaleY(SCALE_HIDDEN); textView.setScaleX(SCALE_HIDDEN); } else { final ImageView iconView = tab.iconView; iconView.setScaleY(SCALE_HIDDEN); iconView.setScaleX(SCALE_HIDDEN); } } viewPager.addOnPageChangeListener(new LivingTabsOnPageChangeListener(this)); }
From source file:cn.wander.Utils.views.pageindicator.TabPageIndicator.java
@SuppressLint("NewApi") private void setTextScale(TextView tv, float scale) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { tv.setScaleX(scale); tv.setScaleY(scale);//ww w.j ava2s. c om } }
From source file:com.zhejunzhu.ucviewpager.weight.StreamTabIndicator.java
public void clearTabChang(int currentIndex) { for (int i = 0; i < mTabLayout.getChildCount(); i++) { if (currentIndex == i) { continue; }//from w w w . j a v a 2 s . co m TextView tab = (TextView) mTabLayout.getChildAt(i); if (tab != null) { tab.setTextColor(mUnSelectColor); tab.setScaleX(1); tab.setScaleY(1); } } }
From source file:com.zhejunzhu.ucviewpager.weight.StreamTabIndicator.java
@Override public void onPageScrolled(int index, float process, int arg2) { LLog.e("indicator onPageScrolled : " + index + " " + process + " " + arg2); TextView leftTab = (TextView) mTabLayout.getChildAt(index); TextView rightTab = (TextView) mTabLayout.getChildAt(index + 1); if (leftTab != null) { leftTab.setTextColor(Color.rgb((int) (11 + 177 * process), 188, 188)); leftTab.setScaleX(1 + (1 - process) / 8); leftTab.setScaleY(1 + (1 - process) / 8); }/*from ww w .j ava 2s .c o m*/ if (rightTab != null) { rightTab.setTextColor(Color.rgb((int) (188 - process * 177), 188, 188)); rightTab.setScaleX(1 + process / 8); rightTab.setScaleY(1 + process / 8); } if (mListener != null) { mListener.onPageScrolled(index, process, arg2); } if (process == 0f) { clearTabChang(index); } }
From source file:com.hannesdorfmann.home.HomeActivity.java
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);/*from www . jav a 2 s . c om*/ title.setScaleX(0.8f); title.animate().alpha(1f).scaleX(1f).setStartDelay(300).setDuration(900).setInterpolator( AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in)); } View amv = toolbar.getChildAt(1); if (amv != null & amv instanceof ActionMenuView) { ActionMenuView actions = (ActionMenuView) amv; popAnim(actions.getChildAt(0), 500, 200); // filter popAnim(actions.getChildAt(1), 700, 200); // overflow } }
From source file:com.android.tv.menu.MenuLayoutManager.java
private void setTempTitleView(TextView dest, TextView src) { dest.setVisibility(View.VISIBLE); dest.setText(src.getText());/*from ww w . j a v a 2 s . c o m*/ dest.setTranslationY(0.0f); if (src.getVisibility() == View.VISIBLE) { dest.setAlpha(src.getAlpha()); dest.setScaleX(src.getScaleX()); dest.setScaleY(src.getScaleY()); } else { dest.setAlpha(0.0f); dest.setScaleX(1.0f); dest.setScaleY(1.0f); } View parent = (View) src.getParent(); dest.setLeft(src.getLeft() + parent.getLeft()); dest.setRight(src.getRight() + parent.getLeft()); dest.setTop(src.getTop() + parent.getTop()); dest.setBottom(src.getBottom() + parent.getTop()); }