當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckedTextView.setEnabled方法代碼示例

本文整理匯總了Java中android.widget.CheckedTextView.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckedTextView.setEnabled方法的具體用法?Java CheckedTextView.setEnabled怎麽用?Java CheckedTextView.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.CheckedTextView的用法示例。


在下文中一共展示了CheckedTextView.setEnabled方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final View itemView = super.getView(position, convertView, parent);
    if (itemView == null) {
        return null;
    }
    final CheckedTextView checkedTextView = (CheckedTextView)itemView;

    if (hasCheckbox(position)) {
        checkedTextView.setEnabled(isEnabled(position));
    } else {
        checkedTextView.setCheckMarkDrawable(null);
        checkedTextView.setTextColor(getResources().getColor(R.color.accent));
    }
    return checkedTextView;
}
 
開發者ID:doc-rj,項目名稱:smartcard-reader,代碼行數:17,代碼來源:AppEditActivity.java

示例2: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
    PassphraseType positionType = getType(position);
    PassphraseType currentType = getCurrentTypeFromArguments();
    Set<PassphraseType> allowedTypes =
            currentType.getAllowedTypes(getIsEncryptEverythingAllowedFromArguments());

    // Set the item to checked it if it is the currently selected encryption type.
    view.setChecked(positionType == currentType);
    // Allow user to click on enabled types for the current type.
    view.setEnabled(allowedTypes.contains(positionType));
    return view;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:15,代碼來源:PassphraseTypeDialogFragment.java

示例3: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
    DialogOption option = mOptions[position];
    view.setChecked(mSelectedOptions.contains(option));
    view.setEnabled(!mDisabledOptions.contains(option));
    return view;
}
 
開發者ID:Smalinuxer,項目名稱:Vafrinn,代碼行數:9,代碼來源:ClearBrowsingDataDialogFragment.java

示例4: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
    PassphraseType positionType = getType(position);
    PassphraseType currentType = getCurrentTypeFromArguments();
    Set<PassphraseType> allowedTypes = currentType.getAllowedTypes(
            getEncryptEverythingAllowedFromArguments());

    // Set the item to checked it if it is the currently selected encryption type.
    view.setChecked(positionType == currentType);
    // Allow user to click on enabled types for the current type.
    view.setEnabled(allowedTypes.contains(positionType));
    return view;
}
 
開發者ID:Smalinuxer,項目名稱:Vafrinn,代碼行數:15,代碼來源:PassphraseTypeDialogFragment.java

示例5: buildView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
private View buildView(Context context) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View view = inflater.inflate(R.layout.track_selection_dialog, null);
  ViewGroup root = (ViewGroup) view.findViewById(R.id.root);

  TypedArray attributeArray = context.getTheme().obtainStyledAttributes(
      new int[] {android.R.attr.selectableItemBackground});
  int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
  attributeArray.recycle();

  // View for disabling the renderer.
  disableView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  disableView.setBackgroundResource(selectableItemBackgroundResourceId);
  disableView.setText(R.string.selection_disabled);
  disableView.setFocusable(true);
  disableView.setOnClickListener(this);
  root.addView(disableView);

  // View for clearing the override to allow the selector to use its default selection logic.
  defaultView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
  defaultView.setText(R.string.selection_default);
  defaultView.setFocusable(true);
  defaultView.setOnClickListener(this);
  root.addView(inflater.inflate(R.layout.list_divider, root, false));
  root.addView(defaultView);

  // Per-track views.
  boolean haveSupportedTracks = false;
  boolean haveAdaptiveTracks = false;
  trackViews = new CheckedTextView[trackGroups.length][];
  for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    TrackGroup group = trackGroups.get(groupIndex);
    boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
    haveAdaptiveTracks |= groupIsAdaptive;
    trackViews[groupIndex] = new CheckedTextView[group.length];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (trackIndex == 0) {
        root.addView(inflater.inflate(R.layout.list_divider, root, false));
      }
      int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
          : android.R.layout.simple_list_item_single_choice;
      CheckedTextView trackView = (CheckedTextView) inflater.inflate(
          trackViewLayoutId, root, false);
      trackView.setBackgroundResource(selectableItemBackgroundResourceId);
      trackView.setText(buildTrackName(group.getFormat(trackIndex)));
      if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
          == RendererCapabilities.FORMAT_HANDLED) {
        trackView.setFocusable(true);
        trackView.setTag(Pair.create(groupIndex, trackIndex));
        trackView.setOnClickListener(this);
        haveSupportedTracks = true;
      } else {
        trackView.setFocusable(false);
        trackView.setEnabled(false);
      }
      trackViews[groupIndex][trackIndex] = trackView;
      root.addView(trackView);
    }
  }

  if (!haveSupportedTracks) {
    // Indicate that the default selection will be nothing.
    defaultView.setText(R.string.selection_default_none);
  } else if (haveAdaptiveTracks) {
    // View for using random adaptation.
    enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
        android.R.layout.simple_list_item_multiple_choice, root, false);
    enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
    enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
    enableRandomAdaptationView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider, root, false));
    root.addView(enableRandomAdaptationView);
  }

  updateViews();
  return view;
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:82,代碼來源:TrackSelectionHelper.java

示例6: buildView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
private View buildView(LayoutInflater inflater) {
    View view = inflater.inflate(R.layout.track_selection_dialog, null);
    ViewGroup root = (ViewGroup) view.findViewById(R.id.root);

    // View for disabling the renderer.
    disableView = (CheckedTextView) inflater.inflate(
            android.R.layout.simple_list_item_single_choice, root, false);
    disableView.setText(R.string.selection_disabled);
    disableView.setFocusable(true);
    disableView.setOnClickListener(this);
    root.addView(disableView);

    // View for clearing the override to allow the selector to use its default selection logic.
    defaultView = (CheckedTextView) inflater.inflate(
            android.R.layout.simple_list_item_single_choice, root, false);
    defaultView.setText(R.string.selection_default);
    defaultView.setFocusable(true);
    defaultView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider_v2, root, false));
    root.addView(defaultView);

    // Per-track views.
    boolean haveSupportedTracks = false;
    boolean haveAdaptiveTracks = false;
    trackViews = new CheckedTextView[trackGroups.length][];
    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        TrackGroup group = trackGroups.get(groupIndex);
        boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
        haveAdaptiveTracks |= groupIsAdaptive;
        trackViews[groupIndex] = new CheckedTextView[group.length];
        for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
            if (trackIndex == 0) {
                root.addView(inflater.inflate(R.layout.list_divider_v2, root, false));
            }
            int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
                    : android.R.layout.simple_list_item_single_choice;
            CheckedTextView trackView = (CheckedTextView) inflater.inflate(
                    trackViewLayoutId, root, false);
            trackView.setText(buildTrackName(group.getFormat(trackIndex)));
            if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
                    == RendererCapabilities.FORMAT_HANDLED) {
                trackView.setFocusable(true);
                trackView.setTag(Pair.create(groupIndex, trackIndex));
                trackView.setOnClickListener(this);
                haveSupportedTracks = true;
            } else {
                trackView.setFocusable(false);
                trackView.setEnabled(false);
            }
            trackViews[groupIndex][trackIndex] = trackView;
            root.addView(trackView);
        }
    }

    if (!haveSupportedTracks) {
        // Indicate that the default selection will be nothing.
        defaultView.setText(R.string.selection_default_none);
    } else if (haveAdaptiveTracks) {
        // View for using random adaptation.
        enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
                android.R.layout.simple_list_item_multiple_choice, root, false);
        enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
        enableRandomAdaptationView.setOnClickListener(this);
        root.addView(inflater.inflate(R.layout.list_divider_v2, root, false));
        root.addView(enableRandomAdaptationView);
    }

    updateViews();
    return view;
}
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:72,代碼來源:TrackSelectionHelper.java

示例7: buildView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
private View buildView(Context context) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View view = inflater.inflate(R.layout.player_track_selection_dialog, null);
  ViewGroup root = (ViewGroup) view.findViewById(R.id.root);

  TypedArray attributeArray = context.getTheme().obtainStyledAttributes(
      new int[] {android.R.attr.selectableItemBackground});
  int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
  attributeArray.recycle();

  // View for disabling the renderer.
  disableView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  disableView.setBackgroundResource(selectableItemBackgroundResourceId);
  disableView.setText(R.string.selection_disabled);
  disableView.setFocusable(true);
  disableView.setOnClickListener(this);
  root.addView(disableView);

  // View for clearing the override to allow the selector to use its default selection logic.
  defaultView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
  defaultView.setText(R.string.selection_default);
  defaultView.setFocusable(true);
  defaultView.setOnClickListener(this);
  root.addView(inflater.inflate(R.layout.player_list_divider, root, false));
  root.addView(defaultView);

  // Per-track views.
  boolean haveSupportedTracks = false;
  boolean haveAdaptiveTracks = false;
  trackViews = new CheckedTextView[trackGroups.length][];
  for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    TrackGroup group = trackGroups.get(groupIndex);
    boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
    haveAdaptiveTracks |= groupIsAdaptive;
    trackViews[groupIndex] = new CheckedTextView[group.length];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (trackIndex == 0) {
        root.addView(inflater.inflate(R.layout.player_list_divider, root, false));
      }
      int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
          : android.R.layout.simple_list_item_single_choice;
      CheckedTextView trackView = (CheckedTextView) inflater.inflate(
          trackViewLayoutId, root, false);
      trackView.setBackgroundResource(selectableItemBackgroundResourceId);
      trackView.setText(buildTrackName(group.getFormat(trackIndex)));
      if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
          == RendererCapabilities.FORMAT_HANDLED) {
        trackView.setFocusable(true);
        trackView.setTag(Pair.create(groupIndex, trackIndex));
        trackView.setOnClickListener(this);
        haveSupportedTracks = true;
      } else {
        trackView.setFocusable(false);
        trackView.setEnabled(false);
      }
      trackViews[groupIndex][trackIndex] = trackView;
      root.addView(trackView);
    }
  }

  if (!haveSupportedTracks) {
    // Indicate that the default selection will be nothing.
    defaultView.setText(R.string.selection_default_none);
  } else if (haveAdaptiveTracks) {
    // View for using random adaptation.
    enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
        android.R.layout.simple_list_item_multiple_choice, root, false);
    enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
    enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
    enableRandomAdaptationView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.player_list_divider, root, false));
    root.addView(enableRandomAdaptationView);
  }

  updateViews();
  return view;
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:82,代碼來源:TrackSelectionHelper.java

示例8: buildView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
private View buildView(Context context) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View view = inflater.inflate(R.layout.track_selection_dialog, null);
  ViewGroup root = view.findViewById(R.id.root);

  TypedArray attributeArray = context.getTheme().obtainStyledAttributes(
      new int[] {android.R.attr.selectableItemBackground});
  int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
  attributeArray.recycle();

  // View for disabling the renderer.
  disableView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  disableView.setBackgroundResource(selectableItemBackgroundResourceId);
  disableView.setText(R.string.selection_disabled);
  disableView.setFocusable(true);
  disableView.setOnClickListener(this);
  root.addView(disableView);

  // View for clearing the override to allow the selector to use its default selection logic.
  defaultView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
  defaultView.setText(R.string.selection_default);
  defaultView.setFocusable(true);
  defaultView.setOnClickListener(this);
  root.addView(inflater.inflate(R.layout.list_divider, root, false));
  root.addView(defaultView);

  // Per-track views.
  boolean haveAdaptiveTracks = false;
  trackViews = new CheckedTextView[trackGroups.length][];
  for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    TrackGroup group = trackGroups.get(groupIndex);
    boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
    haveAdaptiveTracks |= groupIsAdaptive;
    trackViews[groupIndex] = new CheckedTextView[group.length];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (trackIndex == 0) {
        root.addView(inflater.inflate(R.layout.list_divider, root, false));
      }
      int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
          : android.R.layout.simple_list_item_single_choice;
      CheckedTextView trackView = (CheckedTextView) inflater.inflate(
          trackViewLayoutId, root, false);
      trackView.setBackgroundResource(selectableItemBackgroundResourceId);
      trackView.setText(DemoUtil.buildTrackName(group.getFormat(trackIndex)));
      if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
          == RendererCapabilities.FORMAT_HANDLED) {
        trackView.setFocusable(true);
        trackView.setTag(Pair.create(groupIndex, trackIndex));
        trackView.setOnClickListener(this);
      } else {
        trackView.setFocusable(false);
        trackView.setEnabled(false);
      }
      trackViews[groupIndex][trackIndex] = trackView;
      root.addView(trackView);
    }
  }

  if (haveAdaptiveTracks) {
    // View for using random adaptation.
    enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
        android.R.layout.simple_list_item_multiple_choice, root, false);
    enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
    enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
    enableRandomAdaptationView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider, root, false));
    root.addView(enableRandomAdaptationView);
  }

  updateViews();
  return view;
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:77,代碼來源:TrackSelectionHelper.java


注:本文中的android.widget.CheckedTextView.setEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。