Android Button setAlpha

前端 未结 4 1369
太阳男子
太阳男子 2021-01-13 06:47

There are a set of buttons, I want to get the result:

When I click one of them, first I divide them into two parts: the clicked one and the others. I\'m trying to se

4条回答
  •  情歌与酒
    2021-01-13 07:25

    Button btn;
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);   
        setContentView(R.layout.main);  
        btn = (Button) findViewById(R.id.main_btn);  
        Drawable d = getResources().getDrawable(R.drawable.imagen);  
        d.setAlpha(60);  
        btn.setBackgroundDrawable(d);  
    }
    

    This works for me :)

提交回复
热议问题