tabhost嵌套scrollview不能上下滚动?????

酒比花香 2013-12-05 11:52:12
tabhost中的内容,使用了scrollview后,当高度超过手机屏幕的高度时不能上下滚动,请问如何解决???
当然如果您有替代方案,也可以。。。
上代码:
<TabHost
android:id="@+id/mediatabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="50.0dip"
android:layout_gravity="top"
android:background="@drawable/suma_tab_bkg"
android:paddingBottom="0.0dip"
android:paddingLeft="0.0dip"
android:paddingRight="0.0dip"
android:paddingTop="1.0dip" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ScrollView
android:id="@+id/suma_media_tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical" >


<include
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/layout_media_detail_desc" />
</ScrollView>


layout_media_detail_desc.xml(这个文件没啥特别的)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/media_detail_desc"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:id="@id/suma_media_detail_tv_director"
android:layout_width="wrap_content"
android:layout_height="20dip"
android:layout_weight="1"
android:textColor="#000000" />

<TextView
android:id="@id/suma_media_detail_tv_actor"
android:layout_width="wrap_content"
android:layout_height="20dip"
android:layout_weight="1"
android:textColor="#000000" />

<TextView
android:id="@id/suma_media_detail_tv_description"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="20dp"
android:textColor="#000000" />

...全文
345 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lpwy5800 2015-05-19
  • 打赏
  • 举报
回复
求大神解决,我也碰到问题了SCroview放哪都有问题
酒比花香 2013-12-11
  • 打赏
  • 举报
回复
引用 6 楼 u012476249 的回复:
是嘛...这样呀,可是我的Activity木有继承TabActivity呀.... 而且为啥你要在TabWidget外面包一个LinearLayout呢?
TabWidget 可以理解为tabhost的标题项,后面的tabcontent是内容。加入LinearLayout后,可以使标题、内容安装竖直顺序排列。具体原因是我发现在3.0以下版本样式混乱,所以才加了这个LinearLayout。然后tabcontent经过FrameLayout组装成tab。 另你不继承TabActivity,那么id你使用getTabHost取得到?
Clare_0_0 2013-12-11
  • 打赏
  • 举报
回复
引用 5 楼 leehu1987 的回复:
[quote=引用 4 楼 u012476249 的回复:] tabhost的id设置应该是这样的吧.......? android:id="@android:id/tabhost"
不是的,是这样。。。如果Activity继承自 TabActivity那么id为安卓内置id,就像你写的。如果不继承, 那么id可以随便写[/quote] 是嘛...这样呀,可是我的Activity木有继承TabActivity呀.... 而且为啥你要在TabWidget外面包一个LinearLayout呢?
Clare_0_0 2013-12-11
  • 打赏
  • 举报
回复
引用 7 楼 leehu1987 的回复:
[quote=引用 6 楼 u012476249 的回复:] 是嘛...这样呀,可是我的Activity木有继承TabActivity呀.... 而且为啥你要在TabWidget外面包一个LinearLayout呢?
TabWidget 可以理解为tabhost的标题项,后面的tabcontent是内容。加入LinearLayout后,可以使标题、内容安装竖直顺序排列。具体原因是我发现在3.0以下版本样式混乱,所以才加了这个LinearLayout。然后tabcontent经过FrameLayout组装成tab。 另你不继承TabActivity,那么id你使用getTabHost取得到?[/quote] 可以的诶
酒比花香 2013-12-10
  • 打赏
  • 举报
回复
引用 4 楼 u012476249 的回复:
tabhost的id设置应该是这样的吧.......? android:id="@android:id/tabhost"
不是的,是这样。。。如果Activity继承自 TabActivity那么id为安卓内置id,就像你写的。如果不继承, 那么id可以随便写
Clare_0_0 2013-12-10
  • 打赏
  • 举报
回复
tabhost的id设置应该是这样的吧.......? android:id="@android:id/tabhost"
酒比花香 2013-12-06
  • 打赏
  • 举报
回复
怎么没人回复呢??现在csdn 人这么少了?
依然绿茶 2013-12-05
  • 打赏
  • 举报
回复
ScrollView应该放到你tabhost的最外层。
<ScrollView         xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/suma_media_tab1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:scrollbarStyle="insideOverlay"
                    android:scrollbars="vertical" >
   <TabHost
    。。。。。。。
</ScrollView>
酒比花香 2013-12-05
  • 打赏
  • 举报
回复
引用 1 楼 ncepu307 的回复:
ScrollView应该放到你tabhost的最外层。
<ScrollView         xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/suma_media_tab1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:scrollbarStyle="insideOverlay"
                    android:scrollbars="vertical" >
   <TabHost
    。。。。。。。
</ScrollView>
1楼,你好,你这个用的不对啊,直接连tabhost的标题都上下滚动了。

80,357

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧