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

x33g5p2x  于2022-01-20 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(147)

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

ImageButton.setAlpha介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

protected void setShuffleButton(final ImageButton shuffleButton, final boolean shuffled) {
  final int shuffleAlpha = shuffled ? 255 : 77;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    shuffleButton.setImageAlpha(shuffleAlpha);
  } else {
    shuffleButton.setAlpha(shuffleAlpha);
  }
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void onPlayModeChanged(final int repeatMode, final boolean shuffled) {
  switch (repeatMode) {
    case Player.REPEAT_MODE_OFF:
      repeatButton.setImageResource(R.drawable.exo_controls_repeat_off);
      break;
    case Player.REPEAT_MODE_ONE:
      repeatButton.setImageResource(R.drawable.exo_controls_repeat_one);
      break;
    case Player.REPEAT_MODE_ALL:
      repeatButton.setImageResource(R.drawable.exo_controls_repeat_all);
      break;
  }
  final int shuffleAlpha = shuffled ? 255 : 77;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    shuffleButton.setImageAlpha(shuffleAlpha);
  } else {
    shuffleButton.setAlpha(shuffleAlpha);
  }
}

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

private void showFab() {
  fab.setAlpha(0f);
  fab.setScaleX(0f);
  fab.setScaleY(0f);
  fab.setTranslationY(fab.getHeight() / 2);
  fab.animate()
      .alpha(1f)
      .scaleX(1f)
      .scaleY(1f)
      .translationY(0f)
      .setDuration(300L)
      .setInterpolator(AnimUtils.getLinearOutSlowInInterpolator(this))
      .start();
}

代码示例来源:origin: google/santa-tracker-android

@Override
  public void onAnimationUpdate(ValueAnimator valueAnimator) {
    muteButton.setAlpha(
        (float) valueAnimator.getAnimatedValue("alpha"));
    buttonContainer.setAlpha(
        (float) valueAnimator.getAnimatedValue("alpha"));
  }
},

代码示例来源:origin: google/santa-tracker-android

@Override
  public void onAnimationUpdate(ValueAnimator valueAnimator) {
    muteButton.setAlpha(
        (float) valueAnimator.getAnimatedValue("overlayAlpha"));
    background.setAlpha(
        (float) valueAnimator.getAnimatedValue("bgAlpha"));
    buttonContainer.setAlpha(
        (float) valueAnimator.getAnimatedValue("overlayAlpha"));
    resumeButton.setAlpha(
        (float) valueAnimator.getAnimatedValue("overlayAlpha"));
    resumeButton.setScaleX(
        (float) valueAnimator.getAnimatedValue("iconScale"));
    resumeButton.setScaleY(
        (float) valueAnimator.getAnimatedValue("iconScale"));
  }
},

代码示例来源:origin: google/santa-tracker-android

muteButton.setAlpha(0.0f);
resumeButton.setAlpha(0.0f);
buttonContainer.setAlpha(0);

代码示例来源:origin: Ferfalk/SimpleSearchView

/**
 * Sets icons alpha, does not set the back/up icon
 */
public void setIconsAlpha(float alpha) {
  clearButton.setAlpha(alpha);
  voiceButton.setAlpha(alpha);
}

代码示例来源:origin: Ferfalk/SimpleSearchView

/**
 * Sets the back/up icon alpha; does not set other icons
 */
public void setBackIconAlpha(float alpha) {
  backButton.setAlpha(alpha);
}

代码示例来源:origin: stackoverflow.com

setContentView(R.layout.browse);

LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout row = li.inflate(R.layout.row, null);
findViewById(/*id of element you want the row to be added to*/).add(row); //now row is attached
final ImageButton editBrowseButton = (ImageButton) row.findViewById(R.id.imageButton1); //so this is live, visible etc
editBrowseButton.setAlpha(50); //this should work than

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Immediately remove the affects of the last call to {@link #scaleOut}.
 */
public void resetIn() {
  mFloatingActionButton.setAlpha(1f);
  mFloatingActionButton.setVisibility(View.VISIBLE);
  mFloatingActionButtonContainer.setScaleX(1);
  mFloatingActionButtonContainer.setScaleY(1);
}

代码示例来源:origin: gildaswise/HorizontalCounter

private void prepareViews(boolean initializing) {
  value.setVisibility((initializing) ? GONE : VISIBLE);
  plusButton.setVisibility((initializing) ? GONE : VISIBLE);
  minusButton.setVisibility((initializing) ? GONE : VISIBLE);
  value.setAlpha((initializing) ? 0 : 1f);
  plusButton.setAlpha((initializing) ? 0 : 1f);
  minusButton.setAlpha((initializing) ? 0 : 1f);
}

代码示例来源:origin: scoutant/blokish

protected void setState( ImageButton btn, boolean state) {
    btn.setEnabled( state);
//        btn.setAlpha( state ? 200 : 50 );
    btn.setAlpha( state ? 0.78f : 0.196f );
  }

代码示例来源:origin: RWebRTC/WebRTC-Android-Learn

@Override
 public void onClick(View view) {
  boolean enabled = callEvents.onToggleMic();
  toggleMuteButton.setAlpha(enabled ? 1.0f : 0.3f);
 }
});

代码示例来源:origin: LineageOS/android_packages_apps_Jelly

/**
 * Sets the specified image button to the given state, while modifying or
 * "graying-out" the icon as well
 *
 * @param enabled The state of the menu item
 * @param button  The menu item to modify
 */
public static void setImageButtonEnabled(ImageButton button, boolean enabled) {
  button.setEnabled(enabled);
  button.setAlpha(enabled ? 1.0f : 0.4f);
}

代码示例来源:origin: stackoverflow.com

if(a[0][0][0]<1)
{
  // disable all buttons
  for(ImageButton button : buttons) {
    button.setEnabled(false);
    button.setAlpha(6);
  }
}

代码示例来源:origin: ImangazalievM/ReActiveAndroid

@Override
public void close() {
  focusHolder.requestFocus();
  AppUtils.hideSoftKeyboard(folderName);
  doneButton.setVisibility(View.GONE);
  folderName.setText(null);
  leftButton.setAlpha(1f);
  leftButton.setImageResource(R.drawable.ic_add_grey_24dp);
  itemView.setBackgroundResource(0);
  if (adapter != null && adapter.getLastOpened() == this) {
    adapter.setLastOpened(null);
  }
}

代码示例来源:origin: IhorKlimov/Android-WebRtc

private void setupListeners() {
  binding.buttonCallDisconnect.setOnClickListener(view -> onCallHangUp());
  binding.buttonCallSwitchCamera.setOnClickListener(view -> onCameraSwitch());
  binding.buttonCallToggleMic.setOnClickListener(view -> {
    boolean enabled = onToggleMic();
    binding.buttonCallToggleMic.setAlpha(enabled ? 1.0f : 0.3f);
  });
}

代码示例来源:origin: ImangazalievM/ReActiveAndroid

@Override
public void open() {
  doneButton.setVisibility(View.VISIBLE);
  leftButton.setImageResource(R.drawable.ic_close_grey_24dp);
  leftButton.setAlpha(0.5f);
  itemView.setBackgroundResource(R.color.md_white_1000);
  if (adapter.getLastOpened() != null) {
    adapter.getLastOpened().close();
  }
  adapter.setLastOpened(this);
}

代码示例来源:origin: WangDaYeeeeee/Mysplash

@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    super.applyTransformation(interpolatedTime, t);
    float scale = fromScale + (toScale - fromScale) * interpolatedTime;
    float alpha = fromAlpha + (0 - fromAlpha) * interpolatedTime;
    bellBtn.setScaleX(scale);
    bellBtn.setScaleY(scale);
    bellBtn.setAlpha(alpha);
    dot.setAlpha(alpha);
  }
}

代码示例来源:origin: WangDaYeeeeee/Mysplash

@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    super.applyTransformation(interpolatedTime, t);
    float scale = (float) (0.5 + 0.5 * interpolatedTime);
    float alpha = 0 + 1 * interpolatedTime;
    bellBtn.setScaleX(scale);
    bellBtn.setScaleY(scale);
    bellBtn.setAlpha(alpha);
    dot.setAlpha(alpha);
  }
}

相关文章

ImageButton类方法