[英]How to make a RelativeLayout semi-transparent but not the activity
我想將RelativeLayout的一側的RelativeLayout設為半透明。
它是頁腳的一個項目。 它總是可見的,但我只想使其具有50%的黑色透明性。
我曾嘗試使用#11000000 Alpha頻道,但仍然無法正常工作。
謝謝
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.app.photoapp.MainActivity" >
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/ly_footer_text"
android:alwaysDrawnWithCache="true"
android:clipChildren="true"
android:columnWidth="100dp"
android:gravity="center_horizontal"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:padding="0dp"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" />
<!-- Footer THIS LAYOUT TO MAKE SEMI-TRANSPARENT -->
<RelativeLayout
android:id="@+id/ly_footer_text"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#11000000"
android:layout_alignParentBottom="true" >
<TextView
android:id="@+id/tv_footer_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="@string/footer_sub_text"
android:textColor="#999999"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_footer_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_footer_left"
android:layout_alignBottom="@+id/tv_footer_left"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:text="@string/footer_tnc"
android:textColor="#999999"
android:textSize="12sp" />
</RelativeLayout>
</RelativeLayout>
將背景色設置為#AARRGGBB,其中AA是Alpha通道。 例如,您可以將#00000000用作顏色或簡稱方法:#ARGB以便使用#0000。使用速記符號,每個值僅使用兩次,其中#264C與#226644CC ... ... :http:/ /developer.android.com/reference/android/graphics/Color.html
試試這個
android:background="#80000000"
嘗試使用此代碼-
android:background="#50111111"
而不是這個
android:background="#11000000"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.