有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java动态Android按钮样式

我想用java设计一个按钮。需要放置一个背景图像和一个背景变化

但它并没有采用这种风格:

LinearLayout linearLayout = (LinearLayout)findViewById(R.id.dynamicpan);
Button btn = new Button(this,null,R.style.productButton); 
btn.setText(arrProducts[i].toString());
btn.setBackgroundResource(R.drawable.button_style);
linearLayout.addView(btn); 


 <style name="productButton">
   <item name="安卓:textColor">#FFFFFF</item>
   <item name="安卓:textSize">25sp</item>
</style>

有人能帮我解决这个问题吗


共 (0) 个答案