Sam
Sam

Reputation: 731

Actionbar Width

How can I make the action bar fits the screen width in portrait mode. I don't want to have a scrolling effect? Notice the word options is not fully displayed until you scroll to the right.

Also, I'd like to also change the color of the text to be blue as well when the tab is selected?

Thanks, enter image description here

Upvotes: 0

Views: 706

Answers (1)

Sam
Sam

Reputation: 731

Changed the text size using themes. Then, I applied a selecter class that defines the tab states as the following:

 <style name="CustomTheme" parent="android:Theme.Holo">
    <item name="android:actionBarTabTextStyle">@style/Widget.TabText</item>
</style>

<style name="Widget.TabText" parent="@android:style/Widget.Holo.ActionBar.TabText">
    <item name="android:textSize">9sp</item>
    <item name="android:textColor">@drawable/action_bar_tab_text</item>  
</style>

the action_Bar_tab_text is as follows

    <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_selected="true" android:color="@color/text_tab_selected" /> 
  <item android:state_active="true" android:color="@color/text_tab_selected"/> 
  <item android:state_selected="false" android:color="@color/text_tab_unselected" />
  <item android:state_active="false" android:color="@color/text_tab_unselected"/>
</selector>

Upvotes: 0

Related Questions