本文整理汇总了Java中android.widget.RadioButton.setTextColor方法的典型用法代码示例。如果您正苦于以下问题:Java RadioButton.setTextColor方法的具体用法?Java RadioButton.setTextColor怎么用?Java RadioButton.setTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RadioButton
的用法示例。
在下文中一共展示了RadioButton.setTextColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDao = new LibraryDBDao(this);
inputFragment = InputFragment.newInstance();
listFragment = ListFragment.newInstance();
searchFragment = SearchFragment.newInstance();
// 获取Fragment管理器
this.fragmentManager = this.getSupportFragmentManager();
// 设置默认显示的fragment
this.fragmentManager.beginTransaction().replace(R.id.fragmentContainer , this.inputFragment).commit();
RadioButton inputButton = (RadioButton)findViewById(R.id.tabBar_firstBtn);
inputButton.setTextColor(Color.parseColor("#1b3afb"));
}
示例2: tabBarInputButtonClicked
import android.widget.RadioButton; //导入方法依赖的package包/类
public void tabBarInputButtonClicked(View view) {
// 修改按钮字体颜色
RadioButton button = (RadioButton) view;
button.setTextColor(Color.parseColor("#1b3afb"));
RadioButton listButton = (RadioButton)findViewById(R.id.tabBar_secondBtn);
listButton.setTextColor(Color.parseColor("#ffffff"));
RadioButton searchButton = (RadioButton)findViewById(R.id.tabBar_thirdBtn);
searchButton.setTextColor(Color.parseColor("#ffffff"));
// 切换fragment
this.fragmentManager.beginTransaction().replace(R.id.fragmentContainer , this.inputFragment).commit();
}
示例3: tabBarListButtonClicked
import android.widget.RadioButton; //导入方法依赖的package包/类
public void tabBarListButtonClicked(View view) {
// 修改按钮字体颜色
RadioButton currentButton = (RadioButton)view;
currentButton.setTextColor(Color.parseColor("#1b3afb"));
RadioButton inputButton = (RadioButton)findViewById(R.id.tabBar_firstBtn);
inputButton.setTextColor(Color.parseColor("#ffffff"));
RadioButton searchButton = (RadioButton)findViewById(R.id.tabBar_thirdBtn);
searchButton.setTextColor(Color.parseColor("#ffffff"));
// 切换fragment
this.fragmentManager.beginTransaction().replace(R.id.fragmentContainer , this.listFragment).commit();
}
示例4: tabBarSearchButtonClicked
import android.widget.RadioButton; //导入方法依赖的package包/类
public void tabBarSearchButtonClicked(View view) {
// 修改按钮字体颜色
RadioButton currentButton = (RadioButton)view;
currentButton.setTextColor(Color.parseColor("#1b3afb"));
RadioButton inputButton = (RadioButton)findViewById(R.id.tabBar_firstBtn);
inputButton.setTextColor(Color.parseColor("#ffffff"));
RadioButton listButton = (RadioButton)findViewById(R.id.tabBar_secondBtn);
listButton.setTextColor(Color.parseColor("#ffffff"));
// 切换fragment
this.fragmentManager.beginTransaction().replace(R.id.fragmentContainer , this.searchFragment).commit();
}
示例5: setTabStyle
import android.widget.RadioButton; //导入方法依赖的package包/类
/**
* 设置Tab样式
*
* @param rb Tab项
* @param checked 是否选中
*/
private void setTabStyle(RadioButton rb, boolean checked) {
if (checked) {
rb.setTextColor(mNavTextCheckedColor);
if (null == mNavBgCheckedImg) {
rb.setBackgroundColor(mNavBgCheckedColor);
} else {
rb.setBackgroundDrawable(mNavBgCheckedImg);
}
} else {
rb.setTextColor(mNavTextDefaultColor);
rb.setBackgroundColor(Color.TRANSPARENT);
rb.setBackgroundDrawable(null);
}
}
示例6: initCheckGroup
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initCheckGroup(final OrderTestModel.OrderItemCheckListBean model, LayoutInflater inflater) {
for (int z = 0; z < model.checkItemSuggestions.size(); z++) {
final OrderTestModel.OrderItemCheckListBean.CheckItemSuggestionsBean item = model.checkItemSuggestions.get(z);
// final RadioButton ckview = (RadioButton)inflater.inflate(R.layout.fragment_test_item_ck, null);
final RadioButton ckview = new RadioButton(activity);
ckview.setText(item.suggestionOption);
if (item.isChecked.equals("1")) {
checkId = item.checkItemSuggestionsId;
ckview.setChecked(true);
} else {
ckview.setChecked(false);
}
ckview.setTag(item.checkItemSuggestionsId);
ckview.setTextColor(this.getResources().getColor(R.color.gray_text));
ckview.setButtonDrawable(new ColorDrawable(Color.TRANSPARENT));
ckview.setTextSize(18);
ckview.setId(z);
ckview.setPadding(2, 0, 12, 0);
ckview.setGravity(Gravity.CENTER | left);
Drawable drawable = getResources().getDrawable(
R.drawable.checkbox_selector_circle_bac);
// 这一步必须要做,否则不会显示.
drawable.setBounds(0, 0, drawable.getMinimumWidth(),
drawable.getMinimumHeight());
ckview.setCompoundDrawables(drawable, null, null, null);
ckview.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
checkId = (String) ckview.getTag();
}
});
llsugestcontain.addView(ckview);
}
}
示例7: updateRadioGroup
import android.widget.RadioButton; //导入方法依赖的package包/类
private void updateRadioGroup(String name){
radioGroup = findViewById(R.id.radioGroup);
RadioButton rb = new RadioButton(getApplicationContext());
rb.setText(name);
rb.setTextColor(Color.BLACK);
radioGroup.addView(rb);
}
示例8: themeRadioButton
import android.widget.RadioButton; //导入方法依赖的package包/类
public void themeRadioButton(RadioButton radioButton) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
radioButton.setButtonTintList(getTintList());
radioButton.setTextColor(getTextColor());
}
}
示例9: themeRadioButton
import android.widget.RadioButton; //导入方法依赖的package包/类
public void themeRadioButton(RadioButton radioButton) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
radioButton.setButtonTintList(getTintList());
radioButton.setTextColor(getTextColor());
}
}
示例10: initView
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initView() {
final RadioGroup group = (RadioGroup) getView().findViewById(
R.id.ringtoneGroup);
RingtoneManager manager = new RingtoneManager(getActivity());
manager.setType(RingtoneManager.TYPE_RINGTONE);
int pdng = (int) (5 * getResources().getDisplayMetrics().density + .5f);
final String[] columns = {MediaStore.Images.Media.DATA,
MediaStore.Audio.Media._ID};
final String orderBy = MediaStore.Images.Media._ID;
Cursor imagecursor = getActivity().getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, columns, null,
null, orderBy);
int dataColumnIndex = imagecursor
.getColumnIndex(MediaStore.Audio.Media.DATA);
for (int i = 0; i < imagecursor.getCount(); i++) {
imagecursor.moveToPosition(i);
final String uri = imagecursor.getString(dataColumnIndex);
final String title = uri.substring(uri.lastIndexOf("/") + 1);
RadioButton rb = new RadioButton(getActivity());
rb.setLayoutParams(new RadioGroup.LayoutParams(
RadioGroup.LayoutParams.MATCH_PARENT,
RadioGroup.LayoutParams.WRAP_CONTENT));
rb.setText(title);
rb.setTypeface(((OneSheeldApplication) getActivity()
.getApplication()).appFont);
rb.setGravity(Gravity.CENTER);
rb.setPadding(pdng, pdng, pdng, pdng);
rb.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
rb.setTextColor(getResources().getColor(R.color.textColorOnDark));
rb.setBackgroundResource(R.drawable.devices_list_item_selector);
rb.setTag(uri);
rb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((OneSheeldApplication) getActivity().getApplication())
.setBuzzerSound(uri);
}
});
group.addView(rb);
}
}