如何降低标签栏的高度,并在底部显示 [英] How to reduce the tab bar height and display in bottom
本文介绍了如何降低标签栏的高度,并在底部显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
喜 任何人可以告诉如何减少底部的标签栏和显示标签栏的高度
Hi can anybody tell how to reduce the height of tab bar and display tab bar in bottom
感谢
推荐答案
添加下面的方法到类扩展TabActivity
Add the following method to your class that extends TabActivity
public void addNewTab(Context context, String title, int height){
TabHost tabHost = getTabHost(); // The activity TabHost
Intent intent = new Intent().setClass(context, HelloTabsActivity.class);
TabHost.TabSpec spec = tabHost.newTabSpec(title.toLowerCase()).setIndicator(title).setContent(intent);
tabHost.addTab(spec);
int totalTabs = tabHost.getTabWidget().getChildCount();
((RelativeLayout)tabHost.getTabWidget().getChildTabViewAt(totalTabs-1)).removeViewAt(0);
((TextView)((RelativeLayout)tabHost.getTabWidget().getChildTabViewAt(totalTabs-1)).getChildAt(0)).setHeight(30);
tabHost.getTabWidget().getChildAt(totalTabs-1).getLayoutParams().height = height;
}
然后调用它像这样addNewTab(这一点,分页标题,30);
then call it like this addNewTab(this, "tab title", 30);
这篇关于如何降低标签栏的高度,并在底部显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!