android.widget.Button.setBackgroundTintList()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(679)

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

Button.setBackgroundTintList介绍

暂无

代码示例

代码示例来源:origin: NightscoutFoundation/xDrip

buttonTD.setBackgroundTintList(csl);
buttonYTD.setBackgroundTintList(csl);
button7d.setBackgroundTintList(csl);
button30d.setBackgroundTintList(csl);
button90d.setBackgroundTintList(csl);
csl = new ColorStateList(new int[][]{new int[0]}, new int[]{0xFFAA0000});
switch (state) {
  case TODAY:
    buttonTD.setBackgroundTintList(csl);
    break;
  case YESTERDAY:
    buttonYTD.setBackgroundTintList(csl);
    break;
  case D7:
    button7d.setBackgroundTintList(csl);
    break;
  case D30:
    button30d.setBackgroundTintList(csl);
    break;
  case D90:
    button90d.setBackgroundTintList(csl);
    break;

代码示例来源:origin: jamorham/xDrip-plus

buttonTD.setBackgroundTintList(csl);
buttonYTD.setBackgroundTintList(csl);
button7d.setBackgroundTintList(csl);
button30d.setBackgroundTintList(csl);
button90d.setBackgroundTintList(csl);
csl = new ColorStateList(new int[][]{new int[0]}, new int[]{0xFFAA0000});
switch (state) {
  case TODAY:
    buttonTD.setBackgroundTintList(csl);
    break;
  case YESTERDAY:
    buttonYTD.setBackgroundTintList(csl);
    break;
  case D7:
    button7d.setBackgroundTintList(csl);
    break;
  case D30:
    button30d.setBackgroundTintList(csl);
    break;
  case D90:
    button90d.setBackgroundTintList(csl);
    break;

代码示例来源:origin: shkcodes/Lyrically

storageButton.setClickable(false);
storageCheck.setVisibility(View.VISIBLE);
storageButton.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.colorPrimary));
overlayButton.setClickable(false);
overlayCheck.setVisibility(View.VISIBLE);
overlayButton.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.colorPrimary));

代码示例来源:origin: shkcodes/Lyrically

@Override
@SuppressLint("NewApi")
public void onRequestPermissionsResult(int requestCode,
                    String permissions[], int[] grantResults) {
  switch (requestCode) {
    case 12: {
      if (grantResults.length > 0
          && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        // disable the storage permission button
        storageButton.setClickable(false);
        storageCheck.setVisibility(View.VISIBLE);
        storageButton.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.colorPrimary));
        // if both the permissions have been granted, dismiss the permissions dialog
        if (Settings.canDrawOverlays(this) && (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED))
          alertDialog.dismiss();
      }
    }
  }
}

代码示例来源:origin: shkcodes/Lyrically

@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 23) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Settings.canDrawOverlays(this)) {

        // disable the overlay permission button
        overlayButton.setClickable(false);
        overlayCheck.setVisibility(View.VISIBLE);
        overlayButton.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.colorPrimary));

        // if both the permissions have been granted, dismiss the permissions dialog
        if (Settings.canDrawOverlays(this) && (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED))
          alertDialog.dismiss();

      }
    }

  }
}

相关文章

Button类方法