Reputation: 191
I want to make a specific layout for a client but it's not working with me (ignore the language differences) see how the background of the design has alpha while in my layout it doesn't. here's my xml code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="@drawable/bg"
android:fitsSystemWindows="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:orientation="vertical"
android:id="@+id/rootLayout"
android:visibility="visible"
android:gravity="center" >
<include
android:id="@+id/top"
layout="@layout/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:id="@+id/ivTeam"
android:clickable="false"
android:layout_centerInParent="true"
android:focusable="false"
android:alpha="0.5"
android:focusableInTouchMode="false"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_below="@+id/top"
android:weightSum="8"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="32dp"
android:weightSum="2"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/firstRow"
android:layout_marginStart="32dp"
android:layout_weight="1"
android:layout_marginEnd="32dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/rlDraws"
android:layout_width="0dp"
android:layout_weight="1"
android:background="@color/top_blue"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvDraw"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="match_parent"
android:tint="@color/white"
android:layout_margin="4dp"
android:src="@drawable/draw"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/tvDraw"
android:text="@string/draw"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:background="@color/red"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlTeams"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@color/top_blue"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvSupport"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ivSupport"
android:tint="@color/white"
android:src="@drawable/team_land" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/support_team"
android:id="@+id/tvSupport"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:background="@color/red"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:layout_marginTop="4dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/rlResults"
android:layout_width="0dp"
android:background="@color/top_blue"
android:layout_weight="1"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvResults"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/results" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/clouds_results"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:id="@+id/tvResults"
android:background="@color/red"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlNews"
android:layout_width="0dp"
android:layout_weight="1"
android:background="@color/top_blue"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvNews"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/news" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/news"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:id="@+id/tvNews"
android:background="@color/red"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginStart="32dp"
android:layout_weight="6"
android:layout_marginEnd="32dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/rlRating"
android:layout_width="match_parent"
android:background="@color/top_blue"
android:layout_marginTop="8dp"
android:layout_marginBottom="32dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvMyRating"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:tint="@color/white"
android:layout_margin="4dp"
android:src="@drawable/star"/>
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:src="@drawable/star"/>
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:layout_margin="4dp"
android:layout_height="wrap_content"
android:src="@drawable/star"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvMyRating"
android:layout_alignParentBottom="true"
android:text="@string/my_rating"
android:layout_centerHorizontal="true"
android:textColor="@color/white"
android:background="@color/red"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:background="@color/blue"
android:orientation="vertical">
<ListView
android:id="@+id/lst_menu_items"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/blue"
android:divider="@android:color/transparent"
android:paddingTop="5dp" />
</LinearLayout>
</android.support.design.widget.NavigationView>
Upvotes: 0
Views: 66
Reputation: 4220
Hex Opacity Values
100% — FF 95% — F2 90% — E6 85% — D9 80% — CC 75% — BF 70% — B3 65% — A6 60% — 99 55% — 8C 50% — 80 45% — 73 40% — 66 35% — 59 30% — 4D 25% — 40 20% — 33 15% — 26 10% — 1A 5% — 0D 0% — 00
<color name="top_blue">#B3284575</color>
Upvotes: 0
Reputation: 208
Try with
<color name="top_blue">#CC284575</color>
Where CC means 80% opaque. See this answer for further information.
Upvotes: 1