动态为 ImageButton 添加样式
我已动态地将图像按钮添加到我的 Tablerow 中,现在我想将图像按钮的样式定义为我之前定义的样式。我尝试过 setTheme 方法,但似乎不起作用
感谢您的帮助
I have added a imagebutton dynamically to my Tablerow, now i want to define the style for the image button to a style that i have previously defined. I have tried the setTheme method that doesnot seem to work
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过大量搜索后,这就是我发现的并且效果完美。
1) 如果您想在运行时创建具有预定义样式的按钮/imagebutton/anyView,则只需按照以下步骤操作即可
2a) 在 res/layout 中创建一个新的 xml 文件,然后放入您要为其创建的一个元素例如我想创建一个减号按钮。这是 res/layout 中的 minusb.xml
2b) 然后将以下行添加到您要创建它的 java 活动代码中
k after a lot of searching this is what i found and it works perfectly.
1) if you want to create a button/imagebutton/anyView at runtime with a predefined style the you can do so just follow the steps below
2a) Create a new xml file in res/layout and put that one element you want to create for example I wanted to create a minusButton. This is minusb.xml in res/layout
2b) Then add the following lines to your java activity code where you would like to create it