Hello I am using the Sherlock library to achieve the ActionBarTabs in Android but there is some weird issue that text appear in the Tabs are all caps. I dont want to make all caps to captital. How can I achive this ?
I tried this but this is not working
values-v14.xml
<style name="TariffPlansTheme" parent="Theme.Sherlock">
<item name="actionMenuTextAppearance">#style/MyMenuTextAppearance</item>
<item name="android:actionMenuTextAppearance">#style/MyMenuTextAppearance</item>
</style>
<style name="MyMenuTextAppearance" parent="TextAppearance.Sherlock.Widget.ActionBar.Menu">
<item name="android:textAllCaps">false</item>
</style>
AndroidManifest.xml
<activity
android:name="TariffPlansActivity"
android:label="#string/title_activity_tariff_plans"
android:screenOrientation="portrait"
android:theme="#style/TariffPlansTheme">
</activity>
Thanks in advance.
This solved my issue. I was using wrong parent style Menu instead of Tab
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light" />
<style name="TariffPlansTheme" parent="Theme.Sherlock">
<item name="actionBarTabTextStyle">#style/My.TabText.Style</item>
<item name="android:actionBarTabTextStyle">#style/My.TabText.Style</item>
</style>
<style name="My.TabText.Style" parent="#style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>
</resources>
I'm trying to style the action bar inside my app using the code below.
<resources>
<!-- the theme applied to the application or activity -->
<style name="myTheme" parent="#style/Theme.AppCompat">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:textSize">24sp</item>
</style>
simply put the font should be bigger.. but nope.
Any ideas as to why?
Thanks.
Possibly your theme is not applied to activity. Set it in manifest:
<activity
android:name=".YourActivty"
android:theme="#style/myTheme" />
UPDATE 1
You should change action bar text size in such way (changing titleTextStyle):
<style name="Theme.YourTheme" parent="android:style/Theme">
<item name="android:actionBarStyle">#style/Theme.YourTheme.Styled.ActionBar</item>
</style>
<style name="Theme.YourTheme.Styled.ActionBar">
<item name="android:titleTextStyle">#style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item>
</style>
<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="#android:style/Widget.TextView">
<item name="android:textSize">24sp</item>
</style>
I have a problem changing background of my actionbar.
I am following the instructions on
https://developer.android.com/training/basics/actionbar/styling.html
however this does not change anything...
My ActionBar style
<style name="CustomActionBar" parent="#style/Widget.AppCompat.ActionBar.Solid">
<item name="android:background">#drawable/background</item>
<item name="background">#drawable/background</item>
<item name="displayOptions">showCustom</item>
</style>
My main application style is:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">#color/application_background</item>
<item name="actionBarStyle">#style/CustomActionBar</item>
<item name="windowActionBar">false</item>
</style>
And I have set that style to my application via manifest.
I have no idea what is wrong with my code.
Thanks for help
I want to add a style from styles.xml
<style name="BlueActionBar" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#color/blue</item>
<item name="android:textColor">#FFFFFF</item>
</style>
to my Actionbar but just on the Activity BlueActivity (which is still blank). How to do that? I'm stuck :'(
edit:
Why does adding
android:actionBarStyle="#style/BlueActionBar"
to BlueActivity in the Manifest not work?
themes.xml:
<style name="Theme.Project.Activity1" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">#style/Widget.Project.Activity1.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.Project.Activity1.ActionBar</item>
</style>
AndroidManifest.xml:
<activity android:name="com.example.Activity1"
android:theme="#style/Theme.Project.Activity1"
/>
How do i change the Overflow Menu icon on the far right of the action bar as seen in the image below? My Holo theme specifies this 3 row black stack icon by default and i want something else. i can't seem to find a solution for this. I have looked at the documentation on http://developer.android.com/guide/topics/ui/menus.html but it doesn't seem to lend much help.
Thanks!
You can try something like this:
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionOverflowButtonStyle">#style/MyActionButtonOverflow</item>
</style>
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/my_action_bTutton_overflow</item>
</style>
and in AndroidManifest.xml
<application
android:theme="#style/MyTheme" >
Define a custom style: for example, let's call it customoverflow.
In this style you set android:src to the picture you would like to use.
Now create a style with parent Theme.holo.
In this style you need to define:
<item name="android:actionOverflowButtonStyle">#style/customoverflow</item>
I just tested this and it works.
If you are using AppCompat you can achieve by following code.
res/values/themes.xml
<style name="MyTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionOverflowButtonStyle">#style/ActionButtonOverflow</item>
<!-- Support library compatibility -->
<item name="actionOverflowButtonStyle">#style/ActionButtonOverflow</item>
</style>
<style name="ActionButtonOverflow" parent="#style/Widget.AppCompat.ActionButton.Overflow">
<item name="android:src">#drawable/ic_launcher</item>
</style>
and in androidmanifest.xml
<application
android:theme="#style/MyTheme" >
I noticed that it becomes white if the theme of the app is Holo, but it is blackish when the theme is Holo.Light
However, changing the style of the action bar to inherit from Holo and the rest of the app from Holo.Light does not solve the problem, but it should point in the direction of which style you should be modifying.
What I have tried is:
<style name="AppThemeLight" parent="android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="android:windowContentOverlay">#drawable/actionbar_shadow</item>
</style>
<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#color/header_brown</item>
<item name="android:titleTextStyle">#style/ActionBarTitle</item>
<item name="android:icon">#drawable/header</item>
</style>
I have the same problem and I think this is close to a solution
Duplicate question,
Changing overflow icon in the action bar
This is my answer as below,
Change your custom overflow icon of Actionbar in styles.xml
<resources>
<!-- Base application theme. -->
<style name=“MyTheme" parent="#android:style/Theme.Holo">
<!-- Pointer to Overflow style DONT forget! -->
<item name="android:actionOverflowButtonStyle">#style/MyOverFlow</item>
</style>
<!-- Styles -->
<style name="MyOverFlow" parent="#android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/ic_your_action_overflow</item>
</style>
</resources>
Put custom theme "MyTheme" in application tag of AndroidManifest.xml
<application
android:name="com.example.android.MainApp"
android:theme="#style/AppTheme">
</application>
Have fun.#.#
Shalafi's solution works with a few changes! You will need to specifiy theme.Holo as the parent for the theme but it has the downside of changing the default text color(at least in my styles).
The amended code should be:
<style name="AppThemeLight" parent="android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="android:windowContentOverlay">#drawable/actionbar_shadow</item>
</style>
<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#color/header_brown</item>
<item name="android:titleTextStyle">#style/ActionBarTitle</item>
<item name="android:icon">#drawable/header</item>
</style>
Basically Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go values/styles.xml
Shalafi's solution works with a few additions:So
add this code to both res/values-vXX/styles.xml and res/values/styles.xml and this will work like Magic!
<style name="AppTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionOverflowButtonStyle">#style/MyActionButtonOverflow</item>
</style>
<style name="MyActionButtonOverflow"parent="android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/your_overflow_icon</item>
</style>
also add it in AndroidManifest.xml
<application
android:theme="#style/AppTheme" >
<style name="ToolBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:tint">#color/colorAccent</item>
create the above theme.set tint with your color and add this theme to the toolbar.
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ToolBarTheme"/>