2010.12.28(4)——— android tab 过多的问题
16lz
2021-01-23
2010.12.28(4)——— android tab 过多的问题
网上大多都是用Gallery来模拟TabHost 但是自己实在是懒 就没这么做 一种可以凑合着用的简单做法:
只需要吧layout改一下即可
如上 在TabWidget外面加上HorizontalScrollView即可
不过 这样有个问题 宽度貌似改不了了 即使你只有一个tab 它并不会fill_parent 还是原来的宽度
但是 如果很多tab的话 还是好使的
网上大多都是用Gallery来模拟TabHost 但是自己实在是懒 就没这么做 一种可以凑合着用的简单做法:
只需要吧layout改一下即可
<?xml version="1.0" encoding="utf-8"?><TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#001629"> <HorizontalScrollView android:layout_width="fill_parent" android:layout_height="wrap_content"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </HorizontalScrollView> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="95px"> </FrameLayout></TabHost>
如上 在TabWidget外面加上HorizontalScrollView即可
不过 这样有个问题 宽度貌似改不了了 即使你只有一个tab 它并不会fill_parent 还是原来的宽度
但是 如果很多tab的话 还是好使的
更多相关文章
- Android布局居中的几种做法
- Android中获取文本宽度和高度
- 移动端页面宽度自适应
- Android 获取drawable中图片的高度宽度
- android 获取实际view 宽度高度
- Android 中获取屏幕长度及宽度
- Android根据屏幕宽度缩放图片
- Android下如何计算要显示的字符串所占的宽度和高度