I have created a transparent activity with following style:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">#00000000</item>
<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:windowIsFloating">true</item>
<item name="android:windowAnimationStyle">#android:style/Animation</item>
</style>
</resources>
But I am getting black background when I open bottomsheet in that activity. Why I am getting this issue
Related
In my application,the splash screen image for Samsung S5 does not appear properly.Instead of working in Genymotion but not on real device of Samsung S5. Also working on other mobile phone.Below is my style.xml file and in Splash screen i have added one handler consisting using intent
Complete style file is not able to add,so i have provided some useful code
Please help me.
styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="AppTheme.Base"></style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primaryDarker</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:textStyle">normal</item>
<item name="floatingHintEditTextStyle">#style/Widget.FloatingHintEditText</item>
</style>
<style name="Theme.Transparent" parent="android:Theme">
<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:backgroundDimEnabled">false</item>
</style>
<style name="PauseDialogAnimation">
<item name="android:windowEnterAnimation">#anim/zoom_in</item>
<item name="android:windowExitAnimation">#anim/zoom_out</item>
</style>
<style name="Theme.Transparent.splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
I am trying to style the TabBar using the following code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="MyTheme.Base"/>
<style name="MyTheme.Base" parent="Theme.AppCompat">
<item name="colorPrimary">#color/palette_1</item>
<item name="colorPrimaryDark">#color/palette_5</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">true</item>
<item name="android:windowBackground">#color/palette_1</item>
<item name="android:actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="actionBarTabStyle">#style/MyTheme.ActionBarTabBar</item>
<item name="android:actionBarTabStyle">#style/MyTheme.ActionBarTabBar</item>
</style>
<style name="MyTheme.ActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/palette_5</item>
<item name="backgroundStacked">#color/palette_5</item>
<item name="backgroundSplit">#color/palette_5</item>
</style>
<style name="MyTheme.ActionBarTabBar" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#color/palette_5</item>
</style>
<style name="MyTheme.NoTitleBar" parent="MyTheme">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
</resources>
Whewre palette_1 is green and palette_5 is blue for example.
The actionBar is blue but the tabbar stays the color that i define in android:windowBackground, which is green.
This is the code i came up with after searching numerous topics. But yet it seems to be conflicting somewhere.
I am having a problems with my Transparent style inheriting the button style from the parent style (AppTheme). The button has a different style in the TransparentActivity theme.
Here are my styles, with a few items removed for simplicity.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated with http://android-holo-colors.com -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="#style/_AppTheme"/>
<style name="_AppTheme" parent="android:Theme.Light">
...
<item name="android:buttonStyle">#style/ButtonAppTheme</item>
...
</style>
<style name="TransparentActivity" parent="AppTheme">
<item name="android:windowBackground">#color/Trans60</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFullscreen">false</item>
</style>
</resources>
Try using #android:style/Theme.NoDisplay
So change :
<style name="TransparentActivity" parent="AppTheme">
<item name="android:windowBackground">#color/Trans60</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFullscreen">false</item>
</style>
To
<style name="TransparentActivity" parent="#android:style/Theme.NoDisplay">
<item name="android:buttonStyle">#style/ButtonAppTheme</item>
<item name="android:textColor">#android:color/white</item>
</style>
How do you set DialogFragment.STYLE_NO_FRAME, which hides the frame, in your styles.xml file? Or does this have to be done outside of the xml file?
Have a look at this link.
Put STYLE_NO_FRAME in styles.xml
<style name="DialogWindowAnim">
<item name="android:windowFrame">#null</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowEnterAnimation">#anim/slide_up_from_bottom</item>
<item name="android:windowExitAnimation">#anim/slide_down_to_bottom</item>
</style>
<style name="DialogSlideAnim" parent="DialogWindowAnim">
<item name="android:windowAnimationStyle">#style/DialogWindowAnim</item>
</style>
This is how I did it.
I have a transparent theme Activity but this theme will make the Activity 100% transparent.
I need a code such that the Activity will be 50% Transparent. This is my code:
<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">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
You could apply a transparent theme to the required activity. Create a new style in /res/values/style.xml
<resources>
<style name="Transparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Translucent</item>
<item name ="android:windowBackground">#color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
</resources>
The value of transparent is
<color name="transparent">#80000000</color>
Now in AndroidManifest.xml declare the theme of the activity to the one you just created.
<activity android:name="MyActivity" android:theme="#style/Transparent"></activity>