2011-08-29 160 views
0

如何在Android的圖像視圖上顯示透明佈局?如何在圖像視圖上使佈局透明

我在圖像視圖上有一個線性佈局,都在佈局中。我希望線性佈局在圖像視圖上是透明的。我們能做到嗎?

+0

你可以添加一些代碼,請? –

+1

嘗試android:background =「#00000000」 – Samuel

+0

我給了一個佈局(垂直),其中有一個文本視圖..以及圖像視圖 。我希望文本視圖在圖像視圖上顯示爲透明。你能給我一個支持這個問題的例子嗎? – bharath

回答

3

使用該屬性:

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

ya其工作..謝謝 – bharath

+0

我已經改變它到android:background =#80000000「它的工作..部分透明。 – bharath

+0

是的,它工作正常。如果你把80之前你的顏色它將是透明的。信息。](http://developer.android.com/guide/topics/resources/more-resources.html#Color) – kameny

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