0
我有標籤欄和自定義標題欄在同一活動。在靜態模式下,我能夠在同一活動中顯示標籤欄和自定義標題欄。但是,當我將動態值分配給自定義標題欄屬性時,它顯示錯誤爲我可以採取標籤欄和自定義標題欄在同一活動
AndroidRuntimeException:無法將自定義標題與其他標題功能組合 請提供任何建議。
在此先感謝
我有標籤欄和自定義標題欄在同一活動。在靜態模式下,我能夠在同一活動中顯示標籤欄和自定義標題欄。但是,當我將動態值分配給自定義標題欄屬性時,它顯示錯誤爲我可以採取標籤欄和自定義標題欄在同一活動
AndroidRuntimeException:無法將自定義標題與其他標題功能組合 請提供任何建議。
在此先感謝
嘗試:
this.getActionBar().setDisplayShowCustomEnabled(true);
this.getActionBar().setDisplayShowTitleEnabled(false);
this.getActionBar().setDisplayUseLogoEnabled(true);
final LayoutInflater inflator = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v = inflator.inflate(R.layout.header_bar, null);
//if you need to customize anything else about the text, do it here.
//I'm using a custom TextView with a custom font in my layout xml so all I need to do is set title
((TextView)v.findViewById(R.id.header_bar_title)).setText(this.getTitle());
//assign the view to the actionbar
this.getActionBar().setCustomView(v);
,並確保你之前setContentView()
方法做到這一點。