开发者

Android: get height of tab bar?

开发者 https://www.devze.com 2023-03-07 08:30 出处:网络
Is there any way I can get the height of the tab bar in Android? Its getHeig开发者_StackOverflowht() method seems to only return 0.

Is there any way I can get the height of the tab bar in Android? Its getHeig开发者_StackOverflowht() method seems to only return 0.

Thanks!


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 .

0

精彩评论

暂无评论...
验证码 换一张
取 消