当前位置: 首页>>代码示例>>Java>>正文


Java CheckedTextView.setBackgroundResource方法代码示例

本文整理汇总了Java中android.widget.CheckedTextView.setBackgroundResource方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTextView.setBackgroundResource方法的具体用法?Java CheckedTextView.setBackgroundResource怎么用?Java CheckedTextView.setBackgroundResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.CheckedTextView的用法示例。


在下文中一共展示了CheckedTextView.setBackgroundResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addArmorButton

import android.widget.CheckedTextView; //导入方法依赖的package包/类
protected TextView addArmorButton(Position pos) {
	CheckedTextView rsText = new CheckedTextView(getContext());

	rsText.setCheckMarkDrawable(0);
	rsText.setBackgroundResource(R.drawable.icon_armor_btn);
	rsText.setOnClickListener(onArmorClickListener);
	rsText.setOnLongClickListener(onArmorLongClickListener);
	rsText.setGravity(Gravity.CENTER);
	rsText.setTextColor(getResources().getColor(android.R.color.primary_text_light));

	addView(rsText, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, null, pos));

	armorButtons.put(pos, rsText);

	rsText.measure(rsWidthMeasureSpec, rsHeightMeasureSpec);

	rsText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rsText.getMeasuredHeight() / 1.7f);

	return rsText;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:21,代码来源:BodyLayout.java

示例2: getNewListItem

import android.widget.CheckedTextView; //导入方法依赖的package包/类
private TextView getNewListItem(int value) {
	CheckedTextView tv = (CheckedTextView) mInflator.inflate(R.layout.ts_pref_checkbox, null);
	tv.setCheckMarkDrawable(new PathDrawable(PATH_CROSS, mContext, 15));
	tv.setBackgroundResource(R.drawable.bg_top_gray_divider);
	tv.setOnClickListener(this);

	int percent = value * 100 / 255;
	tv.setText(String.format("%d (%d%% of 255)", value, percent));
	tv.setTag(value);
	return tv;
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:12,代码来源:BrightModeListPref.java

示例3: initUi

import android.widget.CheckedTextView; //导入方法依赖的package包/类
private void initUi(String platName) {
	ctvFollow = new CheckedTextView(getActivity());
	try {
		ctvFollow.setBackgroundResource(R.drawable.auth_follow_bg);
	} catch (Throwable t) {
		t.printStackTrace();
	}
	ctvFollow.setChecked(true);
	int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(getActivity(), 10);
	ctvFollow.setCompoundDrawablePadding(dp_10);
	ctvFollow.setCompoundDrawablesWithIntrinsicBounds(R.drawable.auth_cb, 0, 0, 0);
	ctvFollow.setGravity(Gravity.CENTER_VERTICAL);
	ctvFollow.setPadding(dp_10, dp_10, dp_10, dp_10);
	ctvFollow.setText(R.string.sm_item_fl_weibo);
	if (platName.equals("TencentWeibo")) {
		ctvFollow.setText(R.string.sm_item_fl_tc);
	}
	ctvFollow.setTextColor(0xff909090);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	ctvFollow.setLayoutParams(lp);
	LinearLayout llBody = (LinearLayout) getBodyView().getChildAt(0);
	llBody.addView(ctvFollow);
	ctvFollow.setOnClickListener(this);

	ctvFollow.measure(0, 0);
	int height = ctvFollow.getMeasuredHeight();
	TranslateAnimation animShow = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.ABSOLUTE, height,
			Animation.ABSOLUTE, 0);
	animShow.setDuration(1000);
	getWebBody().startAnimation(animShow);
	ctvFollow.startAnimation(animShow);
}
 
开发者ID:snowdream,项目名称:android-sharesdk,代码行数:37,代码来源:MyAdapter.java

示例4: 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

示例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.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

示例6: 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.setBackgroundResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。