I have two ActionBar buttons: one displaying only an icon, another with no icon - I use text to display the number of new items that app receives. The problem is the text size is way too small, would like to make sth bigger.
Tried styling:
<item name="android:actionBarStyle">@style/MyActionBar</item>
no effect.
Tried loading a custom view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:gravity="fill_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:minWidth="64dip"
android:src="@drawable/ic_action_refresh" />
<ImageButton
android:id="@+id/button1"
android:scaleType="centerInside"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
style="?android:attr/actionButtonStyle"
android:text="0" />
No success either.
However, I would prefer to maintain style and properties of the ordinary ActionBar button, just increase text size. Is there a way to achieve that? I do not use Sherlock, below is my code for the ActionBar.
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
<item
android:id="@+id/action_about"
android:title="@string/action_about"
android:showAsAction="never">
</item>
<item
android:id="@+id/action_counter"
android:title="@string/action_counter"
android:showAsAction="always|withText">
</item>
<item
android:id="@+id/action_refresh"
android:title="@string/action_refresh"
android:icon="@drawable/ic_action_refresh"
android:showAsAction="always">
</item>
I would like to change text size of the action_counter only.
In your application's base theme, add the following item:
<item name="android:actionMenuTextAppearance">@style/CustomActionBar</item>
Then define CustomActionBar
as follows:
<style name="CustomActionBar" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Menu">
<item name="android:textSize">20sp</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With