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

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

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

ImageButton.setImageAlpha介绍

暂无

代码示例

代码示例来源: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: woefe/ShoppingList

private void setButtonEnabled(ImageButton button, boolean enabled) {
  button.setEnabled(enabled);
  button.setClickable(enabled);
  button.setImageAlpha(enabled ? 255 : 100);
}

代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android

public void setEnabled(boolean enabled) {
  imageButton.setClickable(enabled);
  imageButton.setImageAlpha(isEnabled() ? 255 : 125);
}

代码示例来源:origin: Calsign/APDE

public void correctUndoRedoEnabled() {
  boolean settingsEnabled = getGlobalState().getPref("pref_key_undo_redo", true);
  
  // Hide undo/redo if user has disabled undo/redo or if we're in an example
  findViewById(R.id.undo_redo_container).setVisibility(settingsEnabled && !getGlobalState().isExample() ? View.VISIBLE : View.GONE);
  
  SketchFile sketchFile = getSelectedSketchFile();
  boolean canUndo = sketchFile != null && sketchFile.canUndo();
  boolean canRedo = sketchFile != null && sketchFile.canRedo();
  
  undoButton.setEnabled(canUndo);
  redoButton.setEnabled(canRedo);
  undoButton.setClickable(canUndo);
  redoButton.setClickable(canRedo);
  
  int alphaEnabled = getResources().getInteger(R.integer.prop_menu_comp_select_alpha_selected);
  int alphaDisabled = getResources().getInteger(R.integer.prop_menu_comp_select_alpha_unselected);
  
  undoButton.setImageAlpha(canUndo ? alphaEnabled : alphaDisabled);
  redoButton.setImageAlpha(canRedo ? alphaEnabled : alphaDisabled);
}

相关文章

ImageButton类方法