2016-04-29 34 views
0

如何使圖片滑塊上的標籤佈局透明...這是我的佈局,我宣佈標籤佈局...我搜索了很多,但我沒有任何解決方案.. 。如何使圖片滑塊上的tablayout透明

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.TabLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="150dp" 
     android:id="@+id/tablayout" 
     android:textAllCaps="false" 
     android:background="#db000000" 
     app:tabMode="fixed" 
     app:elevation="0dp" 
     app:tabGravity="fill" 
     app:tabTextColor="#FFFFFF" 
     app:tabSelectedTextColor="#EF9C1A" 
     android:tabStripEnabled="true" 
     > 
    </android.support.design.widget.TabLayout> 
</RelativeLayout> 

like in this image..

my app is like this

+0

請提供您的MainActivity代碼,你宣佈tabLayout – Asama

回答

1

只需設置它的android:background#70000000。這將使其半透明。只需將70值更改爲適合您的更好的東西。 99變暗。 10是透明的(打火機)

編輯:爲了使其完全透明只需使用android:background="@android:color/transparent"

+0

這不工作...它變成淺灰色,當我設置.. –

+0

所以你想要它完全透明?從圖片「喜歡在這個圖像」這是半透明的,所以我想..順便說一句,只是將背景顏色設置爲@android:顏色/透明 – Asama

+0

我已經試過這個...它使它變成白色..不透明.. –