These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android CheckedTextView class.
checkbox = (CheckedTextView)findViewById(android.R.id.text1); } public void setTask(Task task) { this.task = task; checkbox.setText(task.getName()); checkbox.setChecked(task.isComplete()); } public Task getTask() { return task; } }
} } private void strikeThroughListItem(View view) { CheckedTextView checkedTextView = (CheckedTextView) view; checkedTextView.toggle(); if (checkedTextView.isChecked()) { checkedTextView.setPaintFlags(checkedTextView.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } else { checkedTextView.setPaintFlags(checkedTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } } }
CheckedTextView text1 = (CheckedTextView) view.findViewById(android.R.id.text1); TextView text2 = (TextView) view.findViewById(android.R.id.text2); String tag = texts.get(position).toString(); text1.setText(tag); text2.setText(subtexts.get(position)); ColorScheme colorScheme = PreferenceHelper.getColorScheme(context); int backgroundColor = colorScheme.getSpinnerColor(context); text2.setBackgroundColor(backgroundColor); if (position == 0) { // tag // color should match whatever's in the main log line listview text2.setTextColor(tagColor); } else { // process id text2.setTextColor(colorScheme.getForegroundColor(context)); }
checkbox = (CheckedTextView) findViewById(android.R.id.text1); } public void setTask(Task task) { this.task = task; checkbox.setText(task.getName()); checkbox.setChecked(task.isComplete()); } public Task getTask() { return task; } }
protected View createEntry(LayoutInflater inflater, int resIcon, boolean multipleChoice, ServerInfo.ResourceInfo info) { CheckedTextView view = (CheckedTextView) inflater.inflate(multipleChoice ? android.R.layout.simple_list_item_multiple_choice : android.R.layout.simple_list_item_single_choice, null); view.setPadding(10, 10, 10, 10); view.setCompoundDrawablesWithIntrinsicBounds(resIcon, 0, 0, 0); view.setCompoundDrawablePadding(10); String description = info.getDescription(); if (description == null) description = info.getPath(); // FIXME escape HTML view.setText(Html.fromHtml("<b>" + info.getTitle() + "</b><br/>" + description)); return view; } @Override
checkedTextView.setChecked(b); } @Override public boolean isChecked() { return checkedTextView.isChecked(); } @Override public void toggle() { checkedTextView.toggle(); } }
View v = super.getView(position, convertView, parent); CheckedTextView ctv = (CheckedTextView) v .findViewById(android.R.id.text1); if (mPrivateData.get(position).get("NAME") .equals(mCurrentAccount.name)) { ctv.setChecked(true); } return v; } } }
lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, 64); } else{ lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 64); } CheckedTextView textView = new CheckedTextView(context); textView.setLayoutParams(lp); // Center the text vertically textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER); // Set the text starting position textView.setPadding(36, 0, 0, 0); textView.setText(text); return textView; } public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { CheckedTextView textView = getGenericView(getGroup(groupPosition).toString(),true); return textView;
}); } else if (answerType.equals(TestAnswer.TYPE_MULTIPLE_CHOICE)) { tt.setOnClickListener(new OnClickListener() { public void onClick(View v) { CheckedTextView rb = (CheckedTextView) v; rb.setChecked(!rb.isChecked()); } }); } if (evaluated) { tt.setOnClickListener(null); answerFeedback = (TextView) convertView.findViewById(android.R.id.text2); answerFeedback.setText(Html.fromHtml(a.getFeedback())); feedbackLevel = Test.FEEDBACK_VALUES.indexOf(feedback); if ((feedbackLevel > Test.FEEDBACK_VALUES.indexOf(Test.FEEDBACK_MEDIUM)) && a.getCorrect()) { tt.setTextColor(context.getResources().getColor(R.color.green)); } else { tt.setTextColor(Color.BLACK);