是否可以通过编程方式将Widget.AppCompat.Button主题应用于按钮?以编程方式将主题应用到按钮
Button button = new Button(context);
button.setText("Button");
目前,我使用的是试图实现像程序兼容性主题风格的自定义绘制资源,但我认为这可能是更容易实现。
在布局它实现这样的:提前
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/ThemeBasedOnAppcompatButton"/>
感谢。
谢谢!我想我的方法来实现动态布局是错误的。我会用listview适配器替换它。 –