Android how to get AppCompat.Translucent type theme with support actionbar?

themeoverlay.appcompat.dark.actionbar not found
transparent theme android
android:theme transparent background
how to create transparent theme in android
how to make transparent screen in android
make transparent background activity android
android style translucent
translucent activity theme

I would like to add the support actionbar to one of my activities, I previously had been using the theme.translucent with this activity but in order to make the support actionbar work I needed to inherit the Theme.AppCompat, I need to maintain a translucent theme in this activity but unfortunately there isnt a Theme.AppCompat.translucent that i can see by default, is there any way that this can be done?

You can create a new set of styles to use which have the same properties as Theme.Translucent from themes.xml.

Add the following to your styles.xml file:

<style name="Theme.AppCompat.Translucent">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>

You can change the prefix Theme.AppCompat to something else if you want to inherit other things from the theme such as dialog styles etc. For example, a name like Theme.AppCompat.Light.Translucent would have the properties of the Light theme.

To use the new style, set the theme property to @style/Theme.AppCompat.Translucent

<activity
    android:name=".TranslucentActivity"
    android:theme="@style/Theme.AppCompat.Translucent" >
</activity>

Making transparent background for Activity when using AppCompat , You can create a new set of styles to use which have the same properties as Theme.Translucent from themes.xml. Add the following to your styles.xml file: The action bar appears at the top of an activity's window when the activity uses the AppCompat's AppCompat theme (or one of its descendant themes). You may otherwise add the action bar by calling requestFeature(FEATURE_SUPPORT_ACTION_BAR) or by declaring it in a custom theme with the windowActionBar property.

Parama ,

<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
    </style>

This should be the style header if you want the toolbar to disappear.you can use any parent theme which has NoActionBar for other effects.

Hope this helps

Theming with AppCompat - Android Developers, I would like to add the support actionbar to one of my activities, I previously had been using the theme.translucent with this activity but in order to make the  The general rule is that if you want your code to support older versions of Android, it should have the AppCompat theme and the java code should extend AppCompatActivity. If you have *an activity that doesn't need this support, such as you only care about the latest versions and features of Android, you can apply any theme to it but the java

If we use Translucent for transparent activity. It raises other issues - the color of Msgbox (now white previously black), Default dialog color, the spinners do drop down but do not show the underline and drop-down arrow. The spinners are color black text black; drop-down white drop-down text black and etc. To overcome this problem, you can just use below code

In style

<style name="Theme.AppCompat.Transparent.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
 <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:backgroundDimEnabled">false</item>
</style>

In manifest file

<activity
        android:name=".activity.YourActivityName"
        android:theme="@style/Theme.AppCompat.Transparent.NoActionBar" />

I hope it will help Thanks

Android Themes, We are using activities with semi-transparent backgrounds (for dimmed tutorials). SampleActivity" android:label="@string/app_name" android:theme="@style/​Theme. unless you put elements from Android Design Support Library (for Create transparent theme for AppCompat since it doesn't have one. If your Eclipse can't find Theme.AppCompat.Light for New Android ActionBar Support, this short video might help you.

Cameron's answer is a nice hack , but it produced a floating action bar and tinted my status bar, which i didn't wanted . So i added more xml attributes for making status bar transparent(for sdk >=19) and used java code for making action bar invisible.

mainActivity.java :

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getSupportActionBar().hide();
     ...
    }
     ...
}

styles.xml

<style name="AppTheme.TranslucentBG">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@android:style/Animation</item>

    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>

</style>

manifest.xml

<application
    android:icon="@mipmap/ic_launcher"
    ...
    android:theme="@style/AppTheme"
    ...
    >


    <activity android:name=".MainActivity"
        android:theme="@style/AppTheme.TranslucentBG"
        ...
        >
        ...
    </activity>
</application>

Styles and Themes, This is what you get when you use the theming provided by AppCompat. devices and support has only grown since then (what with tint-aware widgets being This difference in color gives users a clear separation between the a ThemeOverlay is a separate type of parent theme that only changes what is ActionBar" />. The recommended way to style the Toolbar for a Light.DarkActionBar clone would be to use Theme.AppCompat.Light.DarkActionbar as parent/app theme and add the following attributes to the style to hide the default ActionBar:

v14/appcompat/res/values/themes.xml, A theme specifies default colors, fonts, and images, for an Android activity or an The Titanium SDK uses the appcompat library to provide support for themes. off the AppCompat theme with a transparent background and a solid action bar If you have a global theme set, the application can override the theme for a  This class describes how to use the v7 appcompat support library's Toolbar widget as an app bar. There are other ways to implement an app bar—for example, some themes set up an ActionBar as an app bar by default—but using the appcompat Toolbar makes it easy to set up an app bar that works on the widest range of devices, and also gives

Using the App Toolbar, A theme is a type of style that's applied to an entire app, activity, or view AppCompat that's supplied by the Android Support Library. But you'll  When using a base theme of Theme.AppCompat and the AppCompat-provided app bar, you’ll find the app bar’s background automatically uses your colorPrimary.However, if you’re using a Toolbar

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Variant of the appcompat (dark) theme with no action bar. -->. To use the ActionBar utility methods, call the activity's getSupportActionBar () method. This method returns a reference to an appcompat ActionBar object. Once you have that reference, you can call any of the ActionBar methods to adjust the app bar. For example, to hide the app bar, call ActionBar.hide () . Add and handle actions arrow_forward.

Comments
  • Wanted to add a Alertbox to an activity, but wanted to have a translucent ctivity, this is a perfect solution. Added another suggestion as an UPDATE to existing answer.
  • Have one issue with defined Theme. When I apply above theme to <activity> orientation is not working for it, but if I remove above theme orientation is working properly.
  • But I am getting Black ToolBar in the transparent activity. Please help me to fix my bug.
  • it's not good, the right way to add needed attributes to (e.g.) <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">... I've added <item name="android:windowIsTranslucent">true</item> to my AppCompat theme so there is no white background when app starts
  • This is still showing the action bar. To eliminate the action bar just add a parent like: <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">
  • Thanks for the help
  • I used stackoverflow.com/a/21492572/5199061 to create transparent activity, but I had color different issues. But this answer helped me to over come from color different issues as @Monika mentioned on answer. Thanks