在android 4.0或更高版本中显示标题为的操作栏时出现问题
我正在我的应用程序中使用操作栏。我使用sherlock library在android 3.0版下显示操作栏。它工作正常。我想将标题栏添加到我的应用程序中。我执行了以下操作:在android 4.0或更高版本中显示标题为的操作栏时出现问题,android,android-actionbar,actionbarsherlock,Android,Android Actionbar,Actionbarsherlock,我正在我的应用程序中使用操作栏。我使用sherlock library在android 3.0版下显示操作栏。它工作正常。我想将标题栏添加到我的应用程序中。我执行了以下操作: requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title_layout); 在xml中,我做到了这一点: <style
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title_layout);
在xml中,我做到了这一点:
<style name="title_theme" parent="@style/Sherlock.__Theme.DarkActionBar">
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleSize">50dip</item>
<item name="android:windowTitleBackgroundStyle">@style/title_theme</item>
</style>
可能不需要使用标题栏,因为操作栏支持标题功能,所以您只需添加
getSherlockActivity.getSupportActionBar().setTitle(“一些文本”)代码>
您是否尝试过此
getSherlockActivity.getSupportActionBar().setCustomView(customNav);
getSherlockActivity.getSupportActionBar().setDisplayShowCustomEnabled(true)代码>查看更新的答案…(sherlock不支持自定义标题,但支持上面两行)谢谢,但不管我在问题中添加了什么代码,尽管它支持自定义标题,但仅在3.0之前,而不是3.0之后。我使用的是SherlockFragmentActivity和getSherlockActivity()不可用。如果您的类使用SherlockFragment
扩展,则可以使用getSherlockActivity()
You cannot combine custom titles with other title feature..