Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the background of an activity translucent?

I want the white part in this activity to be translucent so that I could partially see the activity below this. This activity uses multiple nested LinearLayouts (ie. One Linear Layout having the red background is inside a Linear Layout with the white background). How can I accomplish this?

enter image description here

This is my AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.h8pathak.dash">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:name="com.example.h8pathak.dash.app.AppController"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".activity.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".activity.RegisterActivity"/>
        <activity android:name=".MainActivity"/>
        <activity android:name=".feed.NewsFeed"/>
        <activity android:name=".feed.NewPost"/>
        <activity android:name=".AnswerPost"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
            <!--android:theme="@android:style/Theme.Translucent.NoTitleBar"-->

    </application>

</manifest>

The activity I'm working on is .AnswerPost

like image 795
TheHardRock Avatar asked Mar 13 '23 22:03

TheHardRock


1 Answers

You can create a transparent activity with the help of

1.Make the background of layout in your xml file transparent by using

android:background="@android:color/transparent"

2.And also,make the theme in your manifest file transparent for that particular acitivity

   <activity
        android:name="Your activity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
    </activity>
like image 143
Meenal Avatar answered Mar 23 '23 09:03

Meenal