settext 在android的作用,setTextAppearance()在Android上不起作用

我已经尝试以编程方式在RadioButton中设置样式的文本,但它们只设置大小和颜色。但是,如果我通过XML设置风格,它可以正常工作。我尝试了TextView同样的情况。我究竟做错了什么?setTextAppearance()在Android上不起作用

Java代码:

public class YourProgOneApps extends Activity implements OnClickListener {

RadioGroup radioGender, radioTarget, radioWhere;

RadioButton man, woman, build_muscle, fat_loss, keep_in_good_shape, gym, home;

TextView textView2;

Button btnExeProgOne;

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.your_prog1);

radioGender = (RadioGroup) findViewById(R.id.radioGender);

man = (RadioButton) findViewById(R.id.man);

woman = (RadioButton) findViewById(R.id.woman);

textView2 = (TextView) findViewById(R.id.textView2);

textView2.setTextAppearance(getApplicationContext(), R.style.radio_chek_f_pre_f);

man.setTextAppearance(this, R.style.radio_chek_f_pre_f);

radioTarget = (RadioGroup) findViewById(R.id.radioTarget);

radioWhere = (RadioGroup) findViewById(R.id.radioWhere);

}

public void onClick(View v) {}

}

style.xml

match_parent

wrap_content

1

@drawable/radio_right

@null

#b4b4b4

20sp

#ffffff

1

1

1

center_horizontal

2013-02-26

Roman

+0

我在文档中注意到TextAppearance有点遗漏了使用的方法。你可以参考你使用的Android版本吗? http://developer.android.com/reference/android/widget/TextView.html#attr_android:textAppearance –

2013-02-26 13:06:45

+0

2.3.3。在Eclipse上。但是这里没有关于弃用方法[link]的说法(http://developer.android.com/reference/android/widget/TextView.html#setTextAppearance%28android.content.Context,%20int%29) –

2013-02-26 13:11:22

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值