我有一个qutestion(pfff)
我有一个带有自定义主题的按钮,用于启用和禁用状态。
const mainButton = document.getElementById('main-btn');
我希望按来源更改主题。
例如,更改文字: <Button
android:id="@+id/btn_on_off"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="activar"
android:textColor="#ffffff"
android:textStyle="bold"
android:theme="@style/**MY_STYLE_A**" />
myButton.setText("new text");
我正在尝试,但我没有成功
答案 0 :(得分:0)
您想以编程方式更改按钮样式吗?
在这里试试这个
btn.setTextAppearance(context,R.style.MY_STYLE_B);