android.widget.TextView.setAlpha()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中android.widget.TextView.setAlpha()方法的一些代码示例,展示了TextView.setAlpha()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setAlpha()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setAlpha

TextView.setAlpha介绍

暂无

代码示例

代码示例来源:origin: prolificinteractive/material-calendarview

@Override
public void onAnimationCancel(Animator animator) {
 doTranslation(title, 0);
 title.setAlpha(1);
}

代码示例来源:origin: zhihu/Matisse

@Override
public void onBindViewHolder(UriViewHolder holder, int position) {
  holder.mUri.setText(mUris.get(position).toString());
  holder.mPath.setText(mPaths.get(position));
  holder.mUri.setAlpha(position % 2 == 0 ? 1.0f : 0.54f);
  holder.mPath.setAlpha(position % 2 == 0 ? 1.0f : 0.54f);
}

代码示例来源:origin: xmuSistone/AndroidPileLayout

@Override
  public void saveNextPosition(int position, String text) {
    this.nextPosition = position;
    this.textView2.setText(text);
    this.textView2.setAlpha(0);
  }
}

代码示例来源:origin: xmuSistone/AndroidPileLayout

@Override
  public void saveNextPosition(int position, String text) {
    this.nextPosition = position;
    this.textView2.setText(text);
    this.textView2.setAlpha(0);
  }
}

代码示例来源:origin: githubwing/ZoomHeader

@Override public void onAnimationUpdate(ValueAnimator animation) {
  mCloseTxt.setAlpha((Float) animation.getAnimatedValue());
 }
});

代码示例来源:origin: githubwing/ZoomHeader

private void doPagerUp(float moveY, float currentY) {
 mMaxY = currentY + moveY;
 setTranslationY(currentY + moveY);
 mCloseTxt.setAlpha(0f);
}

代码示例来源:origin: githubwing/ZoomHeader

private void doPagerDown(float moveY, float currentY) {
 int pos = mViewPager.getCurrentItem();
 View v = mViewPager.getChildAt(pos);
 v.setTranslationY((currentY + moveY) / 4);
 mCloseTxt.setAlpha(v.getY() / 76);
}

代码示例来源:origin: kaushikgopal/RxJava-Android-Samples

private void _showTapText() {
  _tapEventTxtShow.setVisibility(View.VISIBLE);
  _tapEventTxtShow.setAlpha(1f);
  ViewCompat.animate(_tapEventTxtShow).alphaBy(-1f).setDuration(400);
 }
}

代码示例来源:origin: kaushikgopal/RxJava-Android-Samples

private void _showTapText() {
 _tapEventTxtShow.setVisibility(View.VISIBLE);
 _tapEventTxtShow.setAlpha(1f);
 ViewCompat.animate(_tapEventTxtShow).alphaBy(-1f).setDuration(400);
}

代码示例来源:origin: kaushikgopal/RxJava-Android-Samples

private void _showTapText() {
 _tapEventTxtShow.setVisibility(View.VISIBLE);
 _tapEventTxtShow.setAlpha(1f);
 ViewCompat.animate(_tapEventTxtShow).alphaBy(-1f).setDuration(400);
}

代码示例来源:origin: nickbutcher/plaid

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));
  }
}

代码示例来源:origin: githubwing/ZoomHeader

public void restore(float y) {
 mCloseTxt.setAlpha(0f);
 if (y > mFirstY) {
  ValueAnimator closeVa = ValueAnimator.ofFloat(1, 0);

代码示例来源:origin: Ramotion/cardslider-android

private void initCountryText() {
  countryAnimDuration = getResources().getInteger(R.integer.labels_animation_duration);
  countryOffset1 = getResources().getDimensionPixelSize(R.dimen.left_offset);
  countryOffset2 = getResources().getDimensionPixelSize(R.dimen.card_width);
  country1TextView = (TextView) findViewById(R.id.tv_country_1);
  country2TextView = (TextView) findViewById(R.id.tv_country_2);
  country1TextView.setX(countryOffset1);
  country2TextView.setX(countryOffset2);
  country1TextView.setText(countries[0]);
  country2TextView.setAlpha(0f);
  country1TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
  country2TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha) {
  super.setAlpha(alpha);
  invalidateParentIfNeeded();
  fireOnTransformationChangedListener();
}

代码示例来源:origin: xmuSistone/AndroidPileLayout

/**
 * rate从零到1
 */
@Override
public void duringAnimation(float rate) {
  textView1.setAlpha(1 - rate);
  textView2.setAlpha(rate);
  if (nextPosition > currentPosition) {
    textView1.offsetLeftAndRight((int) (leftMargin - leftDistance * rate - textView1.getLeft()));
    textView2.offsetLeftAndRight((int) (leftMargin + rightDistance * (1 - rate) - textView2.getLeft()));
  } else {
    textView1.offsetLeftAndRight((int) (leftMargin + rightDistance * rate - textView1.getLeft()));
    textView2.offsetLeftAndRight((int) (leftMargin * rate - textView2.getLeft()));
  }
}

代码示例来源:origin: xmuSistone/AndroidPileLayout

/**
 * rate从零到1
 */
@Override
public void duringAnimation(float rate) {
  textView1.setAlpha(1 - rate);
  textView2.setAlpha(rate);
  if (nextPosition > currentPosition) {
    textView1.offsetTopAndBottom((int) (0 - verticalDistance * rate - textView1.getTop()));
    textView2.offsetTopAndBottom((int) (0 + verticalDistance * (1 - rate) - textView2.getTop()));
  } else {
    textView1.offsetTopAndBottom((int) (0 + verticalDistance * rate - textView1.getTop()));
    textView2.offsetTopAndBottom((int) (0 - verticalDistance * (1 - rate) - textView2.getTop()));
  }
}

代码示例来源:origin: prolificinteractive/material-calendarview

doTranslation(title, 0);
title.setAlpha(1);
lastAnimTime = now;

代码示例来源:origin: aurelhubert/ahbottomnavigation

icon.setImageDrawable(iconDrawable);
title.setTextColor(currentItem == i ? itemActiveColor : itemInactiveColor);
title.setAlpha(currentItem == i ? 1 : 0);
view.setOnClickListener(new OnClickListener() {
  @Override
icon.setImageDrawable(iconDrawable);
title.setTextColor(itemDisableColor);
title.setAlpha(0);
view.setClickable(true);
view.setEnabled(false);

代码示例来源:origin: fython/MaterialStepperView

} else {
  mDoneIconView.setAlpha(state == STATE_DONE ? 1f : 0f);
  mPointNumber.setAlpha(state == STATE_DONE ? 0f : 1f);

代码示例来源:origin: xinghongfei/LookLook

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(500)
        .setDuration(900)
        .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)).start();
  }
  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
  }
}

相关文章

微信公众号

最新文章

更多

TextView类方法