[英]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.