- 浏览: 63054 次
- 性别:
- 来自: 沈阳
文章分类
最新评论
如何改变Android tab 的高度和字体大小
复制代码
1 int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法
2 for (int i = 0; i < count; i++) {
3 View view = tabWidget.getChildTabViewAt(i);
4 view.getLayoutParams().height = 80; //tabWidget.getChildAt(i)
5 final TextView tv = (TextView) view.findViewById(android.R.id.title);
6 tv.setTextSize(28);
7 tv.setTextColor(this.getResources().getColorStateList(
8 android.R.color.white));
9 }
10
11 //解释二************************************************************************
12 int width =45;
13 int height =48;
14 for(int i = 0; i < tabWidget.getChildCount(); i++)
15 {
16 //设置高度、宽度,不过宽度由于设置为fill_parent,在此对它没效果
17 tabWidget.getChildAt(i).getLayoutParams().height = height;
18 tabWidget.getChildAt(i).getLayoutParams().width = width;
19 /**
20 * 下面是设置Tab的背景,可以是颜色,背景图片等
21 */
22 View v = tabWidget.getChildAt(i);
23 if (tabHost.getCurrentTab() == i) {
24 v.setBackgroundColor(Color.GREEN);
25 //在这里最好自己设置一个图片作为背景更好
26 //v.setBackgroundDrawable(getResources().getDrawable(R.drawable.chat));
27 } else {
28 v.setBackgroundColor(Color.GRAY);
29 }
30 }
复制代码
复制代码
1 int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法
2 for (int i = 0; i < count; i++) {
3 View view = tabWidget.getChildTabViewAt(i);
4 view.getLayoutParams().height = 80; //tabWidget.getChildAt(i)
5 final TextView tv = (TextView) view.findViewById(android.R.id.title);
6 tv.setTextSize(28);
7 tv.setTextColor(this.getResources().getColorStateList(
8 android.R.color.white));
9 }
10
11 //解释二************************************************************************
12 int width =45;
13 int height =48;
14 for(int i = 0; i < tabWidget.getChildCount(); i++)
15 {
16 //设置高度、宽度,不过宽度由于设置为fill_parent,在此对它没效果
17 tabWidget.getChildAt(i).getLayoutParams().height = height;
18 tabWidget.getChildAt(i).getLayoutParams().width = width;
19 /**
20 * 下面是设置Tab的背景,可以是颜色,背景图片等
21 */
22 View v = tabWidget.getChildAt(i);
23 if (tabHost.getCurrentTab() == i) {
24 v.setBackgroundColor(Color.GREEN);
25 //在这里最好自己设置一个图片作为背景更好
26 //v.setBackgroundDrawable(getResources().getDrawable(R.drawable.chat));
27 } else {
28 v.setBackgroundColor(Color.GRAY);
29 }
30 }
复制代码
发表评论
-
android 备用
2014-08-03 13:26 422http://blog.csdn.net/rain_butte ... -
Android中px与dip,sp与dip等的转换工具类(转)
2014-07-16 20:07 577http://www.cnblogs.com/wader201 ... -
android 字体总结
2014-07-15 21:53 528Android提供三种字体:“Sans”,“serif“和“m ... -
mina
2014-07-03 14:12 482http://chwshuang.iteye.com/blog ... -
android获取IMEI
2014-06-17 08:34 507核心代码: Imei = ((TelephonyMan ... -
andorid ui
2014-06-04 22:39 0http://blog.csdn.net/ddddpow/ar ... -
android alarmManage
2014-05-28 21:47 671转自:http://jinguo.iteye.com/bl ... -
adaf
2014-05-27 22:32 0http://www.eoeandroid.com/thr ... -
weixin
2014-05-13 22:42 0android weisixn -
jpajpa
2014-01-28 15:06 487http://www.iteye.com/problems/9 ... -
吉安帕
2014-01-23 22:30 0dfsgdaffgadrgad -
CrudRepository
2013-11-28 19:58 0PagingAndSortingRepository Cr ... -
Android 的第三方报表组件,AChartEngine 案列
2013-08-19 16:48 0http://www.kuaipan.cn/file/id_3 ... -
android sdk adress
2013-08-12 13:23 450developer.android.com/sdk/index ... -
android 结束进程
2013-07-29 22:01 707Android获取apk的版本及包名等信息 http://bl ... -
adnroid 4.0.3去掉虚拟导航栏
2013-07-27 20:54 1015http://blog.csdn.net/wfh1988/ar ... -
andorid全屏
2013-07-27 10:15 771super.onCreate(savedIns ... -
Foursquare
2012-10-12 17:22 0Foursquare -
sqllite brower
2012-09-11 23:05 643http://www.oschina.net/p/sqlite ... -
notice
2012-09-03 21:13 671http://tibaloga.iteye.com/blog/ ...
相关推荐
Android Tab 页面的使用范例, 是一个入门级的例子,初学者可以看一看,会有帮助的.
Android Tab 选项卡 切换; 可以滑动切换,点击切换,带指示器;
三种方法实现android tab 界面切换。1、ViewPager+PagerAdapter 2、FragmentManager+Fragment利用FragmentTransaction对fragment进行hide和show操作实现 3、ViewPager+FragmentPagerAdapter ,主activity继承于...
android Tab页的切换自定义实现,可以实现淘宝,58,京东等客户端的底部导航!
Boosted Android Tab Layout with custom animated indicators including "Dachshund" animation inspired by this. Sample Available Animated Indicators Indicator Example Custom behavior ...
Android Tab 选项卡源代码,是一个很不错的Android源码,有兴趣的伙伴们抽时间可以看一下把
通过Fragment + Viewpager实现Android Tab切换菜单
实现一个简单的android Tab 选项卡控件
该源码实现了tab,并且在同一个tab内部实现了多个activity的跳转。
android Tab 在右侧,就是在右侧
很炫酷的Tab实现源码,包含正常,点下,选中状态
Android TAB
项目中需要实现iphone中tabBar效果, 参考了网上大虾们的例子,实现了tab 中的子Activity跳转,...tab bar 的外观可以自己定制,将自带的tab隐藏,控制自定义的view调用tab的动作就可以,代码很简单,这里没有给出。
NULL 博文链接:https://forlan.iteye.com/blog/2259239
还有DFA的东西 android tab
android tab 切换 整理
android tab控件的简单使用,适合新手
android TAB 屏幕滑动实现tab切换
android Tab底部切换,大家可以学习参考一下,点击下面的tab,就可以实现不同页面的切换
Android Tab(TabLayout+Fragment)实现源码