2012-02-28 77 views
0

我有按钮,并设置背景资源给它:按钮背景Alpha重复

button1.setBackgroundResource(R.layout.color00); 

color00:

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item 
    android:state_pressed="true" 
    android:drawable="@drawable/img00" /> 
    <item 
    android:state_pressed="false" 
    android:drawable="@drawable/img00" /> 
</selector> 

然后我设置阿尔法这个按钮

button1.getBackground().setAlpha(50); 

,然后我有问题。如果我设置这样的背景资源BUTTON2:

button2.setBackgroundResource(R.layout.color00); 

所以BUTTON1的Alpha设置为BUTTON2与该资源阿尔法。如何解决它?

+0

button2.getBackground()。setAlpha(50); – 2012-02-28 15:25:13

+0

我想要有100%alpha的button2 – Leo 2012-02-28 20:23:23

回答