Android: get height of tab bar?

天大地大妈咪最大 提交于 2019-12-13 05:40:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!