android.widget.TextView.setEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(184)

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

TextView.setEnabled介绍

暂无

代码示例

代码示例来源:origin: facebook/stetho

private void onConnected() {
 mConsoleInput.setEnabled(true);
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
}

代码示例来源:origin: iSoron/uhabits

private int deleteLastTypedKey() {
  int deleted = mTypedTimes.remove(mTypedTimes.size() - 1);
  if (!isTypedTimeFullyLegal()) {
    mDoneButton.setEnabled(false);
  }
  return deleted;
}

代码示例来源:origin: Rukey7/MvpApp

/**
 * 处理 VideoEvent,来改变编辑状态UI
 *
 * @param videoEvent
 */
private void _handleVideoEvent(VideoEvent videoEvent) {
  mBtnSelectDel.setEnabled(videoEvent.checkStatus != VideoEvent.CHECK_NONE);
  mBtnSelectAll.setText(videoEvent.checkStatus == VideoEvent.CHECK_ALL ? "取消全选" : "全选");
  mBtnSelectAll.setSelected(videoEvent.checkStatus == VideoEvent.CHECK_ALL);
}

代码示例来源:origin: wangdan/AisenWeiBo

private int deleteLastTypedKey() {
  int deleted = mTypedTimes.remove(mTypedTimes.size() - 1);
  if (!isTypedTimeFullyLegal()) {
    mDoneButton.setEnabled(false);
  }
  return deleted;
}

代码示例来源:origin: hidroh/materialistic

private void toggleControls(boolean sending) {
  if (isFinishing()) {
    return;
  }
  mSending = sending;
  mTitleEditText.setEnabled(!sending);
  mContentEditText.setEnabled(!sending);
  supportInvalidateOptionsMenu();
}

代码示例来源:origin: zhihu/Matisse

private void updateBottomToolbar() {
  int selectedCount = mSelectedCollection.count();
  if (selectedCount == 0) {
    mButtonPreview.setEnabled(false);
    mButtonApply.setEnabled(false);
    mButtonApply.setText(getString(R.string.button_sure_default));
  } else if (selectedCount == 1 && mSpec.singleSelectionModeEnabled()) {
    mButtonPreview.setEnabled(true);
    mButtonApply.setText(R.string.button_sure_default);
    mButtonApply.setEnabled(true);
  } else {
    mButtonPreview.setEnabled(true);
    mButtonApply.setEnabled(true);
    mButtonApply.setText(getString(R.string.button_sure, selectedCount));
  }
  if (mSpec.originalable) {
    mOriginalLayout.setVisibility(View.VISIBLE);
    updateOriginalState();
  } else {
    mOriginalLayout.setVisibility(View.INVISIBLE);
  }
}

代码示例来源:origin: zhihu/Matisse

private void updateApplyButton() {
  int selectedCount = mSelectedCollection.count();
  if (selectedCount == 0) {
    mButtonApply.setText(R.string.button_sure_default);
    mButtonApply.setEnabled(false);
  } else if (selectedCount == 1 && mSpec.singleSelectionModeEnabled()) {
    mButtonApply.setText(R.string.button_sure_default);
    mButtonApply.setEnabled(true);
  } else {
    mButtonApply.setEnabled(true);
    mButtonApply.setText(getString(R.string.button_sure, selectedCount));
  }
  if (mSpec.originalable) {
    mOriginalLayout.setVisibility(View.VISIBLE);
    updateOriginalState();
  } else {
    mOriginalLayout.setVisibility(View.GONE);
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

private void enableButtons() {
  announceButton.setEnabled(true);
  shareButton.setEnabled(true);
  messageButton.setEnabled(true);
}

代码示例来源:origin: facebook/facebook-android-sdk

private void disableButtons() {
  announceButton.setEnabled(false);
  shareButton.setEnabled(false);
  messageButton.setEnabled(false);
}

代码示例来源:origin: smuyyh/BookReader

private void initSearchHistory() {
  List<String> list = CacheManager.getInstance().getSearchHistory();
  mHisAdapter.clear();
  if (list != null && list.size() > 0) {
    tvClear.setEnabled(true);
    mHisAdapter.addAll(list);
  } else {
    tvClear.setEnabled(false);
  }
  mHisAdapter.notifyDataSetChanged();
}

代码示例来源:origin: facebook/stetho

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.irc_chat_activity);
 mConsoleDisplay = (ListView) findViewById(R.id.console_display);
 mConsoleRowAdapter = new IRCConsoleRowAdapter(this);
 mConsoleDisplay.setAdapter(mConsoleRowAdapter);
 mConsoleInput = (TextView) findViewById(R.id.console_input);
 mConsoleInput.setOnEditorActionListener(mOnConsoleInputEditorAction);
 findViewById(R.id.console_send).setOnClickListener(mConsoleSendClicked);
 // Will re-enable once we connect...
 mConsoleInput.setEnabled(false);
 mSimpleIRCConnectionManager = new SimpleIRCConnectionManager(
   getIntent().getStringExtra(EXTRA_HOST_AND_MAYBE_PORT),
   getIntent().getStringExtra(EXTRA_NICKNAME));
 mConnectionExecutor = Executors.newCachedThreadPool();
 mConnectionExecutor.execute(new Runnable() {
  @Override
  public void run() {
   mSimpleIRCConnectionManager.runConnectLoop();
  }
 });
}

代码示例来源:origin: iSoron/uhabits

private boolean addKeyIfLegal(int keyCode) {
  // If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode,
  // we'll need to see if AM/PM have been typed.
  if ((mIs24HourMode && mTypedTimes.size() == 4) ||
      (!mIs24HourMode && isTypedTimeFullyLegal())) {
    return false;
  }
  mTypedTimes.add(keyCode);
  if (!isTypedTimeLegalSoFar()) {
    deleteLastTypedKey();
    return false;
  }
  int val = getValFromKeyCode(keyCode);
  Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val));
  // Automatically fill in 0's if AM or PM was legally entered.
  if (isTypedTimeFullyLegal()) {
    if (!mIs24HourMode && mTypedTimes.size() <= 3) {
      mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
      mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
    }
    mDoneButton.setEnabled(true);
  }
  return true;
}

代码示例来源:origin: jeasonlzy/ImagePicker

@SuppressLint("StringFormatMatches")
  @Override
  public void onImageSelected(int position, ImageItem item, boolean isAdd) {
    if (imagePicker.getSelectImageCount() > 0) {
      mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
      mBtnOk.setEnabled(true);
      mBtnPre.setEnabled(true);
      mBtnPre.setText(getResources().getString(R.string.ip_preview_count, imagePicker.getSelectImageCount()));
      mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted));
      mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted));
    } else {
      mBtnOk.setText(getString(R.string.ip_complete));
      mBtnOk.setEnabled(false);
      mBtnPre.setEnabled(false);
      mBtnPre.setText(getResources().getString(R.string.ip_preview));
      mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted));
      mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted));
    }
//        mImageGridAdapter.notifyDataSetChanged();
//        mRecyclerAdapter.notifyItemChanged(position); // 17/4/21 fix the position while click img to preview
//        mRecyclerAdapter.notifyItemChanged(position + (imagePicker.isShowCamera() ? 1 : 0));// 17/4/24  fix the position while click right bottom preview button
    for (int i = imagePicker.isShowCamera() ? 1 : 0; i < mRecyclerAdapter.getItemCount(); i++) {
      if (mRecyclerAdapter.getItem(i).path != null && mRecyclerAdapter.getItem(i).path.equals(item.path)) {
        mRecyclerAdapter.notifyItemChanged(i);
        return;
      }
    }
  }

代码示例来源:origin: wangdan/AisenWeiBo

private boolean addKeyIfLegal(int keyCode) {
  // If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode,
  // we'll need to see if AM/PM have been typed.
  if ((mIs24HourMode && mTypedTimes.size() == 4) ||
      (!mIs24HourMode && isTypedTimeFullyLegal())) {
    return false;
  }
  mTypedTimes.add(keyCode);
  if (!isTypedTimeLegalSoFar()) {
    deleteLastTypedKey();
    return false;
  }
  int val = getValFromKeyCode(keyCode);
  Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val));
  // Automatically fill in 0's if AM or PM was legally entered.
  if (isTypedTimeFullyLegal()) {
    if (!mIs24HourMode && mTypedTimes.size() <= 3) {
      mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
      mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
    }
    mDoneButton.setEnabled(true);
  }
  return true;
}

代码示例来源:origin: iSoron/uhabits

/**
 * Try to start keyboard mode with the specified key, as long as the timepicker is not in the
 * middle of a touch-event.
 * @param keyCode The key to use as the first press. Keyboard mode will not be started if the
 * key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting
 * key.
 */
private void tryStartingKbMode(int keyCode) {
  if (mTimePicker.trySettingInputEnabled(false) &&
      (keyCode == -1 || addKeyIfLegal(keyCode))) {
    mInKbMode = true;
    mDoneButton.setEnabled(false);
    updateDisplay(false);
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

/**
 * Try to start keyboard mode with the specified key, as long as the timepicker is not in the
 * middle of a touch-event.
 *
 * @param keyCode The key to use as the first press. Keyboard mode will not be started if the
 *                key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting
 *                key.
 */
private void tryStartingKbMode(int keyCode) {
  if (mTimePicker.trySettingInputEnabled(false) &&
      (keyCode == -1 || addKeyIfLegal(keyCode))) {
    mInKbMode = true;
    mDoneButton.setEnabled(false);
    updateDisplay(false);
  }
}

代码示例来源:origin: iSoron/uhabits

mDoneButton.setEnabled(true);
} else {
  Boolean[] enteredZeros = {false, false};

代码示例来源:origin: wangdan/AisenWeiBo

mDoneButton.setEnabled(true);
} else {
  Boolean[] enteredZeros = {false, false};

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

childView.setEnabled(false);
childView.setId(clickableChildCounter++);
childView.setText(text.replaceFirst(REPLACE_REGEX_DISABLED, ""));

相关文章

TextView类方法