</pre> <activity android:name="com.pangzaifei.weixin.Demo" android:label="@string/app_name" android:icon="@drawable/logo" <strong><span style="font-size:24px; color:#ff0000"> android:uiOptions="splitActionBarWhenNarrow"</span></strong><p> ></p><p><img src="https://img-blog.csdn.net/20141229194131644?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2Fuamlhb3poZW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></p><p></p><p>去掉这个属性的设定后,发生改变;</p><p></p><p><img src="https://img-blog.csdn.net/20141229194213686?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2Fuamlhb3poZW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></p><p></p><p></p><p><pre name="code" class="java"> actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
// actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
View v=LayoutInflater.from(this).inflate(R.layout.custemview,null);
ActionBar.LayoutParams lp=new ActionBar.LayoutParams(600,LayoutParams.FILL_PARENT);
lp.gravity=Gravity.RIGHT;
actionBar.setCustomView(v, lp);
// actionBar.addTab(actionBar.newTab().setText("qqq").setIcon(R.drawable.ic_launcher).setTabListener(tl));
// actionBar.addTab(actionBar.newTab().setText("ttt").setIcon(R.drawable.ic_launcher).setTabListener(tl));
showOverFlowAlawys();
想要对actionbar自定以样式,做这个核心设置<pre name="code" class="java">actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
<pre name="code" class="java"> View v=LayoutInflater.from(this).inflate(R.layout.custemview,null);
ActionBar.LayoutParams lp=new ActionBar.LayoutParams(600,LayoutParams.FILL_PARENT);
对应的图:
<span style="white-space:pre"> <img src="https://img-blog.csdn.net/20141229201316984?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2Fuamlhb3poZW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></span>