I want to remove the divider under the ActionBar, already search here for it and tried the different things, but nothing worked for me.
Here are the styles, I hope you can help me.
<style name="ListeningThemeTranslucentActionBar" parent="#style/ListeningTheme">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">#style/ListeningTranslucentActionBar</item>
<item name="android:actionBarDivider">#null</item>
</style>
<style name="ListeningTranslucentActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#android:color/transparent</item>
</style>
You probably didn't apply your styles in the Manifest. You will have to add
android:theme="#style/ListeningThemeTranslucentActionBar"
in your Manifest.xml. (If there is already a android:theme parameter just change it to your theme.)
Also this link might be helpfull.
Related
I worked myself thru the AndroidFundamtentals Tutorial 09.2 (App Settings) but I couldn't find a working solution for my problem.
I want to change the style (backgroundcolor) of the Settings-Fragment in my app.
That's what I have coded in the styles.xml so far:
<style name="AppThemeWithActionBar" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">#color/cr_blue_dark2</item>
<item name="colorPrimaryDark">#color/cr_blue_dark</item>
<item name="colorAccent">#color/cr_green</item>
<!-- more styles-->
<item name="preferenceTheme">#style/AppTheme.SettingsScreen</item>
</style>
<style name="AppTheme.SettingsScreen" parent="PreferenceThemeOverlay">
<item name="backgroundColor">#color/cr_black</item>
<item name="background">#color/cr_black</item> <!--one of these should make the background black-->
</style>
This code does not change the background color of the Settings fragment.
If you need more code just write an comment. :)
I just found the solution / mistake.
The parent of the style AppThemeWithActionBar is wrong.
It changes the background to light.
Change the title of the style like this:
<style name="AppThemeWithActionBar" parent="Theme.MaterialComponents">
Also change the theme of the activity in the Manifest.xml file.
My app is using an own style which I made with the Android Action Bar Style Generator (Style compatibility = AppCombat). The color of the Actionbar and the tab are the same but the problem is that there is a shadow between them. How can I remove this shadow?
<style name="MyAppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowContentOverlay">#null</item>
"android:windowContentOverlay" is removing the shadow below the tab and not above.
Ok here's the solution by Audren Teissier which worked for me:
It's because you are using a drawable instead of a color.look for something like this:
<style name="MyActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/yourcolor</item>
</style>
Replace the drawable by a color like above and it should go away.
Use the below property in your AppBarLayout
app:elevation="0dp"
Use the below code in your fragment
getSupportActionBar().setElevation(0);
The shadow on the status bar is system set and cannot be removed, however the status bar that you are referring to is inside of Theme.Holo.Light. To my knowledge it cannot be removed.
Hope I have understood your question correctly, that is you want to in a way merge the action bar with the tabs so there is no border in between -> the line or shadow you mentioned. If that is correct, then this is what you are looking for:
Add this to your MyAppTheme:
<item name="android:actionBarStyle">#style/LineRemover</item>
and change this line:
<item name="android:windowContentOverlay">#null</item>
to this:
<item name="android:windowActionBarOverlay">true</item>
and then add the following style below:
<style name="LineRemover" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#android:color/transparent</item>
</style>
In the end you have something like this:
<style name="MyAppTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">#style/LineRemover</item>
</style>
<style name="LineRemover" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#android:color/transparent</item>
</style>
I guess you are aware that you have to register your theme in the android manifest (within your activity or application tags:
android:theme="#style/MyAppTheme" >
Please remember to mark this as your accepted answer if this helped you :)
if you set the tab layout elevation Remove.its working fine
So I'm trying to style the tabs of my Actionbar, which I've implemented using the ActionBarSherlock library. This is my code:
<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="actionBarTabStyle">#style/CustomActionBarStyle</item>
<item name="android:actionBarTabStyle">#style/CustomActionBarStyle</item>
<style name="CustomActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar">
<item name="android:background">#drawable/actionbar_tab_bg</item>
</style>
At the second and third line, if I change actionBarTabStyle to actionBarStyle, my actionbar itself is changed to my wanted style (not very well, ofcourse), so the connections do work. However, trying to change the actionbar tabs (below it), has still no success.
I hope somebody can help me.
With Regards,
The following should work
<style name="Theme.app" parent="#style/Theme.Sherlock.Light">
<item name="android:actionBarTabBarStyle">#style/Theme.app.tabbar.style</item>
<item name="actionBarTabBarStyle">#style/Widget.app.ActionBar.TabBar</item>
</style>
<style name="Theme.app.tabbar.style" parent="#style/Theme.Sherlock.Light">
<item name="android:background">#FF0000</item>
<item name="background">#FF0000</item>
</style>
<style name="Widget.app.ActionBar.TabBar" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:background">#FF0000</item>
<item name="background">#FF0000</item>
</style>
This makes the tabBar red.
You need to set two times the actionBarTabBarStyle. This is because of Android > 3.0 and Android <3.0
In your CustomActionBarStyle you need to have
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="background">#drawable/actionbar_tab_bg</item>
Hope this helps :)
So I had some difficulties with the styling because of a certain way I found to add the tabs by code in the first place. Thank you for the responses, they all work.
I am trying to apply default styling for all the listViews from style.xml
Please note at some places I am using nested listViews.
In style.xml
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:windowContentOverlay">#null</item>
<item name="android:listViewStyle">#style/awesomeListViewStyle</item>
</style>
<style name="awesomeListViewStyle" parent="#android:style/Widget.ListView">
<item name="android:fadingEdge">none</item>
<item name="android:background">#color/orange</item>
<item name="android:divider">#EEEEEE</item>
</style>
This has no effect. In the Manifest Theme.MyTheme as my default theme.
Please advice :)
As mentioned in another answer as Bhavin and Mark pointed out, in your style you should also add
<item name="android:dividerHeight">1px</item>
Please give me solution to hide the status bar of translucant screen, i have tries by setting Theme.NoTitleBar.Fullscreen but it works for normal activity, but its not working for the screen witch is translucant.Please give me the hint to solve the problem.
Thanks
That's how I usually do this by overriding one of standard themes.
<style name="ExampleTheme" parent="android:Theme.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
You then can apply the theme to your activity. I hope that helps.
Above solution is not work for me.
I used "#android:style/Theme.Holo.NoActionBar.Fullscreen" as parent theme.
<style name="ExampleTheme" parent="#android:style/Theme.Holo.NoActionBar.Fullscreen">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
https://developer.android.com/training/system-ui/status