【发布时间】:2011-05-23 18:45:46
【问题描述】:
如何将样式(大小)设置为按钮可编程方式?
有可能吗?
我可以将样式设置为来自 xml 资源的按钮(如 styte= ?android:attr/buttonStyleSmall)。 但我不知道如何设置它的可编程方式。
提前致谢。
【问题讨论】:
-
我正在尝试在运行时更改按钮样式。
标签: android
如何将样式(大小)设置为按钮可编程方式?
有可能吗?
我可以将样式设置为来自 xml 资源的按钮(如 styte= ?android:attr/buttonStyleSmall)。 但我不知道如何设置它的可编程方式。
提前致谢。
【问题讨论】:
标签: android
你可以这样做:
Button button = new Button(this, null, android.R.attr.buttonStyleSmall);
【讨论】:
您不能在运行时修改样式,抱歉。
【讨论】: