Guest User

Untitled

a guest
Sep 11th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. How can I change the font style on ActionBarSherlock
  2. <style name="Theme.MyAppDefaults" parent="@style/Theme.Sherlock.Light">
  3. <item name="android:textSize">@dimen/default_textsize</item>
  4. <item name="actionBarSize">@dimen/action_bar_height</item>
  5. </style>
  6.  
  7. <style name="Theme.MyApp.Default" parent="@style/Theme.Sherlock.Light">
  8. <item name="actionBarStyle">@style/MyApp.SherlockActionBarStyle</item>
  9. <item name="android:actionBarStyle">@style/MyApp.SherlockActionBarStyle</item>
  10. </style>
  11.  
  12. <style name="MyApp.SherlockActionBarStyle" parent="@style/Widget.Sherlock.ActionBar">
  13. <item name="titleTextStyle">@style/MyApp.ActionBar.TextAppearance</item>
  14. </style>
  15.  
  16. <style name="MyApp.ActionBar.TextAppearance" parent="@style/TextAppearance.Sherlock.Widget.ActionBar.Menu">
  17. <item name="android:textSize">@dimen/default_textsize</item>
  18. <item name="android:textColor">@color/dark_grey</item>
  19. </style>
  20.  
  21. <TextView
  22. android:id="@+id/action_custom_title"
  23. android:layout_width="wrap_content"
  24. android:layout_height="wrap_content"
  25. android:text="My Custom title"
  26. android:textColor="#fff"
  27. android:textSize="18sp" />
  28.  
  29. _actionBar.setDisplayShowTitleEnabled(false);
  30.  
  31. LayoutInflater inflater = LayoutInflater.from(this);
  32. View customView = inflater.inflate(R.layout.custom_action_layout, null);
  33.  
  34. TextView titleTV = (TextView) customView.findViewById(R.id.action_custom_title);
  35. // you can apply a custom typeface here or do sth else...
  36.  
  37. _actionBar.setCustomView(customView);
  38. _actionBar.setDisplayShowCustomEnabled(true);
Add Comment
Please, Sign In to add comment