如何更改按钮的文本颜色?
最佳答案
试试这个:
button.setTextColor(getApplication().getResources().getColor(R.color.red)); //TAKE DEFAULT COLOR
或
button.setTextColor(0xff0000); //SET CUSTOM COLOR
或
button.setTextColor(Color.parseColor("#ff0000"));
在 xml 中:
<Button android:id="@+id/mybtn"
android:text="text textx "
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#ff0000" /> <-- SET TEXT COLOR HERE -->
关于android - 如何更改按钮的文本颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11176365/