ScrollView填满整个屏幕

ScrollView中布局显示两个元素,一个标签切换,一个viewpager,布局如下:

<ScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tl="http://schemas.android.com/apk/res-auto"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="#eeeeee"
   android:scrollbars="none"
   android:fillViewport="true"
   >

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:orientation="vertical">

       <com.joint.turman.app.widget.tablayout.SlidingTabLayout
           android:id="@+id/frg_mymessage_tabs"
           android:layout_width="match_parent"
           android:layout_height="48dp"
           android:background="#6D8FB0"
           android:paddingLeft="5dp"
           android:paddingRight="5dp"
           tl:tl_indicator_margin_left="2dp"
           tl:tl_indicator_margin_right="2dp"
           tl:tl_indicator_style="BLOCK"/>

       <android.support.v4.view.ViewPager
           android:id="@+id/frg_mymessage_list"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           />

   </LinearLayout>

</ScrollView>

这里需要将scrollview中fillviewport设置为true,并将layout_height设置为match_parent才能使viewpager不会留出空白。如果没有fillviewport属性,在linearlayout中设置layout_height为match_parent是无效的!


转载于:https://my.oschina.net/buobao/blog/611296

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值