2010.12.28(4)——— android 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的话 还是好使的

更多相关文章

  1. Android布局居中的几种做法
  2. Android中获取文本宽度和高度
  3. 移动端页面宽度自适应
  4. Android 获取drawable中图片的高度宽度
  5. android 获取实际view 宽度高度
  6. Android 中获取屏幕长度及宽度
  7. Android根据屏幕宽度缩放图片
  8. Android下如何计算要显示的字符串所占的宽度和高度

随机推荐

  1. [转载]android—OpenGL—GL10方法解析(转
  2. Android(安卓)Studio 手动创建活动(Activ
  3. Android之封装支付宝支付
  4. 动画效果编程基础详解--Animation Androi
  5. 【移动开发】Android中的底部菜单框架(Fra
  6. 在Android上面如何使用带有心跳检测的Soc
  7. Activity之启动模式(android:launchMode)
  8. 【android】Cursor记录集游标、ListView
  9. Android:pt 、sp、dp之间的换算
  10. android的文件系统结构及其引导过程的初