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

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

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

ImageView.setImageAlpha介绍

暂无

代码示例

代码示例来源:origin: mohak1712/UberUX

@Override
public void onTransitionStart(Transition transition) {
  ivBack.setImageAlpha(0);
}

代码示例来源:origin: mohak1712/UberUX

@Override
public void onTransitionEnd(Transition transition) {
  ivBack.setImageAlpha(255);
  Animation animation = AnimationUtils.loadAnimation(LoginWithPhone.this, R.anim.slide_right);
  ivBack.startAnimation(animation);
}

代码示例来源:origin: mohak1712/UberUX

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_login);
  setupWindowAnimations();
  ButterKnife.bind(this);
  DisplayMetrics displayMetrics = new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
  int height = displayMetrics.heightPixels;
  uber.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (0.65 * height)));
  ivBack.setImageAlpha(0);
}

代码示例来源:origin: julian-klode/dns66

stateImage.setImageAlpha(255);
stateImage.setImageTintList(ContextCompat.getColorStateList(context, R.color.colorStateImage));
switch(status) {
  case AdVpnService.VPN_STATUS_STOPPED:
    stateImage.setImageDrawable(context.getDrawable(R.mipmap.app_icon_large));
    stateImage.setImageAlpha(32);
    stateImage.setImageTintList(null);
    startButton.setText(R.string.action_start);

代码示例来源:origin: julian-klode/dns66

void updateState() {
  iconView.setImageAlpha(255 * 87 / 100);
  if (stateChoices == 2) {
    switch (item.state) {
      case Configuration.Item.STATE_IGNORE:
      case Configuration.Item.STATE_DENY:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_check_box_outline_blank_black_24dp));
        iconView.setContentDescription(context.getString(R.string.do_not_use_dns_server));
        break;
      case Configuration.Item.STATE_ALLOW:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_check_box_black_24dp));
        iconView.setContentDescription(context.getString(R.string.use_dns_server));
        break;
    }
  } else {
    switch (item.state) {
      case Configuration.Item.STATE_IGNORE:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_ignore));
        iconView.setImageAlpha(255 * 38 / 100);
        break;
      case Configuration.Item.STATE_DENY:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_deny));
        break;
      case Configuration.Item.STATE_ALLOW:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_allow));
        break;
    }
    iconView.setContentDescription(context.getResources().getStringArray(R.array.item_states)[item.state]);
  }
}

代码示例来源:origin: mohak1712/UberUX

@Override
public void onTransitionStart(Transition transition) {
  InputMethodManager imm = (InputMethodManager) getSystemService(
      Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(etPhoneNo.getWindowToken(), 0);
  tvMoving.setText(null);
  tvMoving.setHint(getString(R.string.enter_no));
  ivFlag.setImageAlpha(0);
  tvCode.setAlpha(0);
  etPhoneNo.setVisibility(View.GONE);
  etPhoneNo.setCursorVisible(false);
  etPhoneNo.setBackground(null);
  Animation animation = AnimationUtils.loadAnimation(LoginWithPhone.this, R.anim.slide_left);
  ivBack.startAnimation(animation);
}

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

ImageView img= (ImageView) findViewById(R.id.image);
img.setImageResource(R.drawable.my_image);
img.setImageAlpha(20);

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

@Override
  public void run() {
    mBluetoothIcon.setImageAlpha(255);
    Toast.makeText(BluetoothActivity.this, "Bluetooth mic connected", Toast.LENGTH_SHORT).show();
  }
});

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

@Override
  public void run() {
    mBluetoothIcon.setImageAlpha(64);
    Toast.makeText(BluetoothActivity.this, "Bluetooth mic disconnected", Toast.LENGTH_SHORT).show();
  }
});

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

@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
  int[] images = { R.drawable.walk, R.drawable.run, R.drawable.jump }

  ImageView imageView = new ImageView(mContext);
  if (position < imgMapper.length) {

    imageView.setImageResource(images[position]);

    if (position != selectedImage) {
      imageView.setImageAlpha(50);
    }
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new GridView.LayoutParams(150, 150));
  };

  return imageView;
}

代码示例来源:origin: mingjunli/GithubApp

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setAlpha(View view, int alpha) {
  if (view instanceof ImageView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    ((ImageView) view).setImageAlpha(alpha);
  } else {
    ViewCompat.setAlpha(view, alpha);
  }
}

代码示例来源:origin: jclehner/rxdroid

@TargetApi(16)
  @SuppressWarnings("deprecation")
  private static void setImageAlpha(ImageView image, int alpha)
  {
    if(Version.SDK_IS_JELLYBEAN_OR_NEWER)
      image.setImageAlpha(alpha);
    else
      image.setAlpha(alpha);
  }
}

代码示例来源:origin: Leaking/WeGit

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setAlpha(View view, int alpha) {
  if (view instanceof ImageView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    ((ImageView) view).setImageAlpha(alpha);
  } else {
    ViewCompat.setAlpha(view, alpha);
  }
}

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

public static void setImageAlpha(ImageView img, int alpha)
 {
   if(Build.VERSION.SDK_INT > 15)
   {
     img.setImageAlpha(alpha);
   }
   else
   {
     img.setAlpha(alpha);
   }
 }

代码示例来源:origin: youlookwhat/ScrollShapeUI

@Override
  public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
    binding.titleToolBar.setBackgroundColor(Color.TRANSPARENT);
    binding.ivTitleHeadBg.setImageAlpha(0);
    binding.ivTitleHeadBg.setVisibility(View.VISIBLE);
    return false;
  }
}).into(binding.ivTitleHeadBg);

代码示例来源:origin: grzegorznittner/chanu

@TargetApi(16)
protected static void setAlpha(ImageView iv, int alpha) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
    deprecatedSetAlpha(iv, alpha);
  else
    iv.setImageAlpha(alpha);
}

代码示例来源:origin: jahirfiquitiva/IconShowcase

private void colorOverflowMenuItem(ImageView overflow) {
  if (overflow != null) {
    if (overflowDrawableId != null) {
      overflow.setImageResource(overflowDrawableId);
    }
    if (iconsColor != null) {
      overflow.setColorFilter(iconsColor);
    }
    overflow.setImageAlpha(iconsAlpha);
  }
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mBluetoothIcon = (ImageView) findViewById(R.id.ic_bluetooth);
  mBluetoothIcon.setVisibility(View.VISIBLE);
  mBluetoothIcon.setImageAlpha(128);
  mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
  mBroadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
      int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, -1);
      processBluetoothState(state);
    }
  };
}

代码示例来源:origin: ywwynm/EverythingDone

@Override
  public void onBindViewHolder(BaseThingViewHolder holder, int position) {
    super.onBindViewHolder(holder, position);
    holder.cv.setRadius(0);
    holder.cv.setCardElevation(0);
    int alpha = (int) (mWidgetAlpha / 100f * 255);
    int alphaColor = DisplayUtil.getTransparentColor(
        thing.getColor(), alpha);
    holder.cv.setCardBackgroundColor(alphaColor);
    holder.ivStickyOngoing.setImageAlpha(alpha);
  }
};

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

/**
 * Called from {@link AudioMeterActivity#onPause()} to shutdown/release the audio device(s) and audio sampler
 */
@Override
protected void releaseAudioDevices() {
  mBluetoothIcon.setImageAlpha(64);
  if (mWZAudioDevice == null) return;
  if (mWZAudioDevice.isSamplingAudio())
    mWZAudioDevice.stopAudioSampler();
  mWZAudioDevice.unregisterAudioSampleListener(mAudioLevelMeter);
  unregisterReceiver(mBroadcastReceiver);
  // Stop bluetooth SCO audio connection.
  WOWZLog.debug(TAG, "Stopping Bluetooth SCO audio connection");
  mAudioManager.stopBluetoothSco();
}

相关文章

ImageView类方法