Change my customize theme into transparent theme for my activity - android

I have this customized theme which I want to convert into Transparent theme
<resources>
<style name="MyMaterialTheme" parent="MyMaterialTheme.Base"></style>
<style name="MyMaterialTheme.Base"
parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item> </style>
</resources>

Do the following
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
The value #color/transparent is the color value #00000000 which I put in res/values/color.xml file. You can also use #android:color/transparent in later Android versions.
Then apply the style to your Activity, for example:
<activity android:name=".SampleActivity" android:theme="#style/Theme.Transparent">
...
</activity>

Add this style in your `values/styles.xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
And the following in `values/styles.xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>

Try putting these items
<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>

Related

ToolBar overflow menu shown in black theme when TabLayout is used

I have a custom ToolBar layout. I am using that in many activities. In all activities except the ones which uses TabLayout, the menu is light theme. But in Tab activities, it is holo theme. How can I fix this?
styles.xml
<resources>
<style name="AppTheme" parent="MyMaterialTheme.Base">
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/primaryBlue</item>
<item name="colorPrimaryDark">#color/secondaryBlue</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.Light.PopupMenu.Overflow">
<item name="android:windowDisablePreview">true</item>
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">5.0dp</item>
<!--<item name="android:popupBackground">#FFF</item>-->
</style>
<style name="ToolbarStyle" parent="#style/ThemeOverlay.AppCompat.ActionBar">
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorControlNormal">#color/primaryWhite</item>
</style>
<style name="Base.Widget.Design.TabLayout" parent="android:Widget">
<item name="tabIndicatorColor">#color/primaryBlack</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabPaddingStart">12dp</item>
<item name="tabPaddingEnd">12dp</item>
<item name="tabBackground">?attr/selectableItemBackground</item>
<item name="tabTextAppearance">#style/TabTheme</item>
<item name="tabSelectedTextColor">#color/primaryBlack</item>
</style>
<style name="TabTheme" parent="TextAppearance.AppCompat.Button">
<item name="android:textSize">#dimen/design_tab_text_size</item>
<item name="android:textColor">#color/primaryBlack</item>
<item name="textAllCaps">true</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDisablePreview">true</item>
</style>
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="StarRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/rating_bar_selector</item>
<item name="android:minHeight">48dip</item>
<item name="android:maxHeight">48dip</item>
<item name="android:numStars">5</item>
<item name="android:rating">4</item>
<item name="android:stepSize">1</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">48dip</item>
<item name="android:layout_marginLeft">4dip</item>
<item name="android:layout_marginTop">4dip</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Add the below line into your theme attribute:
<item name="android:textColorSecondary">#android:color/white</item>

Why doesn't theme inherit button style

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 in styles.xml?

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.

Remove Top Shadow By Notification Bar in Android

How can I remove the shadow by the notification bar?
Themes.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ExposureTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:windowBackground">#color/app_background_image</item>
<item name="android:colorBackground">#color/app_background</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:background">#android:color/transparent</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleSize">0dp</item>
<item name="android:tabWidgetStyle">#style/ExposureTheme.TabWidget</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="ExposureTheme.TabWidget" parent="#android:Widget.Holo.Light.TabWidget">
<item name="android:showDividers">none</item>
</style>
</resources>

Changing The Style Of Actionbar Overflow

I am using Theme.Holo in My Current android app.
Above is the overflow UI from my current theme.
I want to customize overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64).
Following is the style.xml I am using
<style name="CustomActivityTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/CustomActivityTheme.ActionBar</item>
<item name="android:actionMenuTextColor">#000000</item>
<item name="android:divider">#drawable/action_bar_div</item>
<item name="android:actionOverflowButtonStyle">#style/MyActionButtonOverflow</item>
</style>
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/overflow</item>
</style>
<style name="CustomActivityTheme.ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/actionbar_bg</item>
<item name="android:titleTextStyle">#style/CustomActivityTheme.ActionBar.Text</item>
<item name="android:subtitleTextStyle">#style/CustomActivityTheme.ActionBar.Text</item>
</style>
<style name="CustomActivityTheme.ActionBar.Text" parent="#android:style/TextAppearance">
<item name="android:textColor">#000000</item>
<item name="android:textSize">16sp</item>
</style>
<style name="activated" parent="android:Theme.Holo">
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
</style>
<!-- style for removing the floating dialog -->
<style name="CustomDialogTheme">
<item name="android:windowIsFloating">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<!-- style for transparent image resource activity -->
<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:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">#style/MyAnimation.Window</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->
<style name="MyAnimation.Window" parent="#android:style/Animation.Dialog">
<item name="android:windowEnterAnimation">#anim/grow_from_middle</item>
<item name="android:windowExitAnimation">#anim/shrink_to_middle</item>
</style>
<!-- style for transparent audio and video resource activity -->
<style name="Theme.Transparent_Player" 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:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowAnimationStyle">#style/MyPlayerAnimation.Window</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->
<style name="MyPlayerAnimation.Window" parent="#android:style/Animation.Dialog">
<item name="android:windowEnterAnimation">#anim/grow_from_action_bar</item>
<item name="android:windowExitAnimation">#anim/shrink_to_action_bar</item>
</style>
How can I customize theme to match overflow menu's background color to RGB (245, 243, 239), and the font color to RGB (64, 64, 64) in above code?
Thanks in advance..
to change text color you can use :
<item name="android:textAppearanceLargePopupMenu" >#style/m_textAppearanceLargePopupMenu</item>
<item name="android:textAppearanceSmallPopupMenu" >#style/m_textAppearanceSmallPopupMenu</item>
<style name="m_textAppearanceLargePopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
<item name="android:textColor">#FFF</item>
</style>
<style name="m_textAppearanceSmallPopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
<item name="android:textColor">#FFF</item>
</style>
this will change the popup menu text color to white
Try this:
<style name="CustomActivityTheme" parent="#android:style/Theme.Holo">
...
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
...
</style>
<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:background">#f5fdef</item>
</style>
I found it at this post
<style name="MyActionBar3" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:background">#color/ActionBarBackground</item>
</style>
<style name="MyActionBarDropDownStyle" parent="">
<item name="android:background">#00FF00</item>
<item name="android:divider">#ff0000</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">10sp</item>
</style>
<style name="MyTextStyle" parent="#style/Widget.AppCompat.Light.Base.ListPopupWindow">
<item name="android:popupBackground">#FF0000</item>
</style>
Apply the style to android:textAppearanceLargePopupMenu" item's attribute

Categories

Resources