本文整理匯總了Java中android.widget.CheckedTextView.setBackgroundColor方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckedTextView.setBackgroundColor方法的具體用法?Java CheckedTextView.setBackgroundColor怎麽用?Java CheckedTextView.setBackgroundColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.CheckedTextView
的用法示例。
在下文中一共展示了CheckedTextView.setBackgroundColor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getView
import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) {
view = LayoutInflater.from(context).inflate(R.layout.single_tasque_row, null);
} else {
view = convertView;
}
if (data.moveToPosition(position)) {
CheckedTextView title = (CheckedTextView) view.findViewById(R.id.single_tasque_row_checked_title);
if (forDelete.get(position)) {
title.setBackgroundColor(selected_color);
} else {
title.setBackgroundColor(deselected_color);
}
Utility.applyFontSize(title);
title.setText(data.getString(data.getColumnIndex(Categories.NAME)));
title.setTag(data.getString(data.getColumnIndex(Categories.ID)));
title.setChecked(checked.get(position));
}
return view;
}
示例2: initUi
import android.widget.CheckedTextView; //導入方法依賴的package包/類
private void initUi() {
followCheckedText = new CheckedTextView(getActivity());
try {
followCheckedText.setBackgroundColor(getActivity().getResources().getColor(android.R.color.white));
} catch (Throwable t) {
Log.w(TAG, t);
}
followCheckedText.setChecked(true);
int dp_10 = com.mob.tools.utils.R.dipToPx(getActivity(), 10);
followCheckedText.setCompoundDrawablePadding(dp_10);
followCheckedText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.bg_checkbox, 0, 0, 0);
followCheckedText.setGravity(Gravity.CENTER_VERTICAL);
followCheckedText.setPadding(dp_10, dp_10, dp_10, dp_10);
followCheckedText.setText(R.string.follow_us);
followCheckedText.setTextColor(0xff909090);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
followCheckedText.setLayoutParams(lp);
LinearLayout llBody = (LinearLayout) getBodyView().getChildAt(0);
llBody.addView(followCheckedText);
followCheckedText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckedTextView ctv = (CheckedTextView) v;
ctv.setChecked(!ctv.isChecked());
}
});
followCheckedText.measure(0, 0);
int height = followCheckedText.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);
followCheckedText.startAnimation(animShow);
}