如何在图像视图上使布局透明

时间:2011-08-29 07:20:51

标签: android android-layout

如何在Android中的图像视图中显示透明布局?

我在图像视图中有一个线性布局,两者都在布局中。我希望线性布局在图像视图上是透明的。我们能做到吗?

2 个答案:

答案 0 :(得分:3)

使用此属性:

android:background="@android:color/transparent"

答案 1 :(得分:0)

// "image transparent programmatically android"    


float alpha_first = 0.2f;
    float alpha_second = 1.0f;
        AlphaAnimation alphadp = new AlphaAnimation(alpha_second, alpha_first);
            switch (v.getId()) {
            case R.id.disable_deactivate_pic:
            ImageButton disable_button =(ImageButton)findViewById(R.id.disable_deactivate_pic);
                    if (!flag) {
                        disable_button.setImageResource(R.drawable.enable_active);

                        linearLayout_for_picture = (LinearLayout) findViewById(R.id.linearlayout_imageView_pic);

                    alphadp.setFillAfter(true);
                    linearLayout_for_picture.startAnimation(alphadp);
                    flag=true;
                    }
            else {
                        disable_button.setImageResource(R.drawable.disable_active);
                        alphadp.setFillAfter(false);
                        linearLayout_for_picture.startAnimation(alphadp);
                        flag=false;
                    }

                break;








      [1]: http://i.stack.imgur.com/A0V2V.png