Tuesday, August 12, 2014

Change Opacity programmatically


  • ImageView change opacity programmatically


                ImageView Img = (ImageView) findViewById(R.id.Img);
                Img.setAlpha(45);




  • Change Background opacity programmatically


                LinearLayout LLayout = (LinearLayout) findViewById(R.id.LLayout);
                   
                LLayout.setBackgroundResource(Color.RED);
                LLayout.getBackground().setAlpha(30);

No comments:

Post a Comment