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

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

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

Button.setContentDescription介绍

暂无

代码示例

代码示例来源:origin: henrichg/PhoneProfilesPlus

protected void setRightEnabled(boolean enabled) {
  mRight.setEnabled(enabled);
  if (!enabled) {
    mRight.setContentDescription(null);
  }
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

protected void setLeftRightEnabled(boolean enabled) {
    mLeft.setEnabled(enabled);
    mRight.setEnabled(enabled);
    if (!enabled) {
      mLeft.setContentDescription(null);
      mRight.setContentDescription(null);
    }
  }
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

protected void setLeftRightEnabled() {
  mLeft.setEnabled(true);
  mRight.setEnabled(canAddDecimal());
  if (!canAddDecimal()) {
    mRight.setContentDescription(null);
  }
}

代码示例来源:origin: derry/delion

private void updateButton() {
  if (mButton == null || mAppData == null) return;
  String text;
  String accessibilityText = null;
  boolean enabled = true;
  if (mInstallState == INSTALL_STATE_NOT_INSTALLED) {
    text = mAppData.installButtonText();
    accessibilityText = getContext().getString(
        R.string.app_banner_view_native_app_install_accessibility, text);
  } else if (mInstallState == INSTALL_STATE_INSTALLING) {
    text = getContext().getString(R.string.app_banner_installing);
    enabled = false;
  } else {
    text = getContext().getString(R.string.app_banner_open);
  }
  mButton.setText(text);
  mButton.setContentDescription(accessibilityText);
  mButton.setEnabled(enabled);
}

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

@Override
public void onBindViewHolder(BaseViewHolder viewHolder, int position) {
  if (mType == Def.PickerType.COLOR_HAVE_ALL) {
    if (position == 0) {
      AllColorViewHolder holder = (AllColorViewHolder) viewHolder;
      if (mPickedPosition == 0) {
        holder.bt.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_checkbox_checked, 0, 0, 0);
        holder.bt.setContentDescription(
            mActivity.getString(R.string.cd_picked) + holder.bt.getText() + ",");
      } else {
        holder.bt.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_checkbox_unchecked, 0, 0, 0);
        holder.bt.setContentDescription(
            mActivity.getString(R.string.cd_unpicked) + holder.bt.getText() + ",");
      }
      holder.bt.setClickable(mPickedPosition != 0);
    } else {
      setFab(viewHolder, position);
    }
  } else if (mType == Def.PickerType.COLOR_NO_ALL) {
    setFab(viewHolder, position);
  }
}

相关文章

Button类方法