问题
Is there any way I can get the height of the tab bar in Android? Its getHeight() method seems to only return 0.
Thanks!
回答1:
Try this in your code .
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
RelativeLayout relativeLayout =(RelativeLayout)tabHost.getTabWidget().getChildAt(i);
relativeLayout.getChildCount();
TextView tabhostText = (TextView) relativeLayout.getChildAt(1);
tabhostText.setTextSize(20.0f); // you can set the TextSize of your tab also
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 30;
}
It will work .
来源:https://stackoverflow.com/questions/6053291/android-get-height-of-tab-bar