本文整理汇总了Java中android.support.v7.widget.AppCompatCheckedTextView类的典型用法代码示例。如果您正苦于以下问题:Java AppCompatCheckedTextView类的具体用法?Java AppCompatCheckedTextView怎么用?Java AppCompatCheckedTextView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppCompatCheckedTextView类属于android.support.v7.widget包,在下文中一共展示了AppCompatCheckedTextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}
nightModeSwitch = (AppCompatCheckedTextView) findViewById(R.id.night_mode_switch);
nightModeSwitch.setOnClickListener(view -> onNightModeCheckChange());
nightModeSwitch.setChecked(new UserPrefs().isNightMode());
nightModeSwitch.setEnabled(!new UserPrefs().isDayNightMode());
dayNightSwitch = (AppCompatCheckedTextView) findViewById(R.id.auto_theme_switch);
dayNightSwitch.setChecked(new UserPrefs().isDayNightMode());
dayNightSwitch.setOnClickListener(view -> onAutoThemeChange());
instructorSwitch = (AppCompatCheckedTextView) findViewById(R.id.instructor_switch);
instructorSwitch.setChecked(new UserPrefs().isInstructor());
instructorSwitch.setOnClickListener(view -> onChangeInstructor());
}
示例2: onCreateView
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
// Allow super to try and create a view first
final View result = super.onCreateView(name, context, attrs);
if (result != null) {
return result;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
switch (name) {
case "EditText":
return new AppCompatEditText(this,attrs);
case "Spinner":
return new AppCompatSpinner(this,attrs);
case "CheckBox":
return new AppCompatCheckBox(this,attrs);
case "RadioButton":
return new AppCompatRadioButton(this,attrs);
case "CheckedTextView":
return new AppCompatCheckedTextView(this,attrs);
}
}
return null;
}
示例3: onCreateView
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
final View result = super.onCreateView(name, context, attrs);
if (result != null) {
return result;
}
// Provide colorized/tinted widgets on non-Material devices
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
switch (name) {
case "EditText":
return new AppCompatEditText(this, attrs);
case "Spinner":
return new AppCompatSpinner(this, attrs);
case "CheckBox":
return new AppCompatCheckBox(this, attrs);
case "RadioButton":
return new AppCompatRadioButton(this, attrs);
case "CheckedTextView":
return new AppCompatCheckedTextView(this, attrs);
}
}
return null;
}
示例4: onCreateView
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
// Allow super to try and create a view first
final View result = super.onCreateView(name, context, attrs);
if (result != null) {
return result;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// If we're running pre-L, we need to 'inject' our tint aware Views in place of the
// standard framework versions
switch (name) {
case "EditText":
return new AppCompatEditText(this, attrs);
case "Spinner":
return new AppCompatSpinner(this, attrs);
case "CheckBox":
return new AppCompatCheckBox(this, attrs);
case "RadioButton":
return new AppCompatRadioButton(this, attrs);
case "CheckedTextView":
return new AppCompatCheckedTextView(this, attrs);
}
}
return null;
}
示例5: changeTaskNameState
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
/**
* Change background color, text color
*/
public void changeTaskNameState(View view, AppCompatCheckedTextView taskNameText, boolean completed) {
taskNameText.setChecked(completed);
if (completed) {
view.setBackgroundColor(ContextCompat.getColor(mContext, R.color.mt_gray5));
taskNameText.setTextColor(ContextCompat.getColor(mContext, R.color.mt_gray6));
} else {
view.setBackgroundColor(ContextCompat.getColor(mContext, android.R.color.white));
taskNameText.setTextColor(ContextCompat.getColor(mContext, R.color.mt_black));
}
}
示例6: onClickRecyclerItem
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public void onClickRecyclerItem(View v, int position) {
Task task = mListsTaskListAdapter.getItem(position);
AppCompatCheckedTextView taskNameText = (AppCompatCheckedTextView) v.findViewById(R.id.lists_task_name);
mListsTaskListAdapter.changeTaskNameState(v, taskNameText, !task.isCompleted());
TaskRepository.updateByCompleted(mUIThreadRealm, task, !task.isCompleted());
}
示例7: getDefaultViewDefStyleAttr
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@SuppressLint({"PrivateResource", "InlinedApi"})
@Override
protected int getDefaultViewDefStyleAttr(View view) {
if (view instanceof AppCompatRadioButton) {
return R.attr.radioButtonStyle;
} else if (view instanceof AppCompatCheckBox) {
return R.attr.checkboxStyle;
} else if (view instanceof AppCompatButton) {
return R.attr.buttonStyle;
} else if (view instanceof AppCompatMultiAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatEditText) {
return R.attr.editTextStyle;
} else if (view instanceof AppCompatCheckedTextView) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
android.R.attr.checkedTextViewStyle : 0;
} else if (view instanceof AppCompatTextView) {
return android.R.attr.textViewStyle;
} else if (view instanceof AppCompatSpinner) {
return R.attr.spinnerStyle;
} else if (view instanceof AppCompatImageButton) {
return R.attr.imageButtonStyle;
} else if (view instanceof AppCompatRatingBar) {
return R.attr.ratingBarStyle;
} else if (view instanceof AppCompatSeekBar) {
return R.attr.seekBarStyle;
} else {
return super.getDefaultViewDefStyleAttr(view);
}
}
示例8: onCreateView
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
// Allow super to try and create a view first
final View result = super.onCreateView(name, context, attrs);
if (result != null) {
return result;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// If we're running pre-L, we need to 'inject' our tint aware Views in place of the
// standard framework versions
switch (name) {
case "EditText":
return new AppCompatEditText(this, attrs);
case "Spinner":
return new AppCompatSpinner(this, attrs);
case "CheckBox":
return new AppCompatCheckBox(this, attrs);
case "RadioButton":
return new AppCompatRadioButton(this, attrs);
case "CheckedTextView":
return new AppCompatCheckedTextView(this, attrs);
default: // do nothing
break;
}
}
return null;
}
示例9: changeTaskNameState
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
/**
* Change background color, text color
*/
public void changeTaskNameState(View view, AppCompatCheckedTextView taskNameText, boolean completed,
Resources resources) {
taskNameText.setChecked(completed);
if (completed) {
view.setBackgroundColor(resources.getColor(R.color.mt_gray5));
taskNameText.setTextColor(resources.getColor(R.color.mt_gray6));
} else {
view.setBackgroundColor(resources.getColor(android.R.color.white));
taskNameText.setTextColor(resources.getColor(R.color.mt_black));
}
}
示例10: changeTranNameState
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
/**
* Change background color, text color
*/
public void changeTranNameState(View view, AppCompatCheckedTextView tranNameText, String aTranClass,
Resources resources) {
tranNameText.setChecked(aTranClass.equalsIgnoreCase("支払い"));
if (aTranClass.equalsIgnoreCase("支払い")) {
tranNameText.setTextColor(resources.getColor(android.R.color.holo_red_light));
view.setBackgroundColor(resources.getColor(android.R.color.background_light));
} else if (aTranClass.equalsIgnoreCase("収入")){
tranNameText.setTextColor(resources.getColor(android.R.color.holo_blue_light));
view.setBackgroundColor(resources.getColor(android.R.color.background_light));
} else {
tranNameText.setTextColor(resources.getColor(android.R.color.holo_orange_dark));
view.setBackgroundColor(resources.getColor(android.R.color.background_light));
}
}
示例11: onClickRecyclerItem
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public void onClickRecyclerItem(View v, int position) {
Tran tran = mListsTranListAdapter.getItem(position);
AppCompatCheckedTextView tranNameText = (AppCompatCheckedTextView) v.findViewById(R.id.lists_tran_name);
mListsTranListAdapter.changeTranNameState(v, tranNameText, "収入", getResources());
TranRepository.update(tran);
}
示例12: onClickRecyclerItem
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
@Override
public void onClickRecyclerItem(View v, int position) {
Task task = mListsTaskListAdapter.getItem(position);
AppCompatCheckedTextView taskNameText = (AppCompatCheckedTextView) v.findViewById(R.id.lists_task_name);
mListsTaskListAdapter.changeTaskNameState(v, taskNameText, !task.isCompleted(), getResources());
TaskRepository.updateByCompleted(mUIThreadRealm, task, !task.isCompleted());
}
示例13: getLeftCtv
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
public AppCompatCheckedTextView getLeftCtv() {
return mLeftCtv;
}
示例14: getRightCtv
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
public AppCompatCheckedTextView getRightCtv() {
return mRightCtv;
}
示例15: getTitleCtv
import android.support.v7.widget.AppCompatCheckedTextView; //导入依赖的package包/类
public AppCompatCheckedTextView getTitleCtv() {
return mTitleCtv;
}