I have a fragment A that covers up the whole screen and another fragment B that is at the bottom of the screen of 50dp.Fragment B overlaps some bottom portion of fragment A.I want to make fragment B translucent so the overlapped portion of fragment A is seen.
I tried using Theme.Translucent,used framelayouts,used setAlpha() method,but didn't get the desired result.Just like we have a translucent actionbar in android,similarly I want to make my fragment B translucent.
I tried referring to these links... link1 : making the background translucent
link 2: https://zaman91.wordpress.com/2010/03/22/android-how-to-create-transparent-or-opeque-background/
link3: Making a android button’s background translucent,
some code to help you understand..
<?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/com.examples"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:fitsSystemWindows="true" >
<!-- Your normal content view -->
<com.examples.views.SlidingUpPanelLayout
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/icn_actionbar_background"
android:minHeight="?attr/actionBarSize" >
<com.examples.views.CustomTextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:singleLine="true"
android:text="Toolbar Title"
android:textColor="@color/action_bar_text"
android:textSize="18sp"
android:textStyle="bold"
app:font="@string/font_avenirMedium" />
</android.support.v7.widget.Toolbar>
<!-- Say this is Fragment A -->
<fragment
android:id="@+id/frag_fragmentA"
android:name="com.examples.fragments.FragmentA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" />
<!-- The rest of your content view -->
</LinearLayout>
<!-- this is fragment B -->
<fragment
android:id="@+id/fragment B"
android:name="com.examples.fragments.MyFragmentB"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top" />
</com.examples.SlidingUpPanelLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:fitsSystemWindows="true" >
<!-- Your drawer content -->
<include
android:id="@+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
layout="@layout/drawer_layout" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
the offset of 50dp is given in the SlidingPanelLayout itself..so only 50 dp of fragment B is visible.
In all these links Theme.Translucent is added to activity theme..but I want to create a theme that makes only that fragment translucent.
Any suggestions or help guys..deeply appreciated.Thanks.