安卓:获得标签栏的高度? [英] Android: get height of tab bar?

查看:185
本文介绍了安卓:获得标签栏的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法,我可以得到Android的标签栏的高度?它的getHeight()方法似乎只能返回0。

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

谢谢!

推荐答案

试试这个在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆