今天热门
热点:

解释下,为什么LinearLayout在FrameLayout下面就会固定到底部,linearlayout底部



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </FrameLayout>

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:background="?attr/colorPrimary" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="abc"/>
</LinearLayout>


刚学android,想做一个tab选项卡,请问下,为什么LinearLayout 放在FrameLayout,并且设置android:layout_weight="1"以后就被固定到底部了,网上看了很多关于FrameLayout布局还是没看明白。

解决方案

你的linearlayout本身就在framelayout下面,并且指定了固定高度,然后framelayout又设置了Layout_weight属性
所以linearlayout占用了最下面的70dp的高度,剩余的屏幕都属于framelayout了

www.zrccd.nettrue/topics/20180309/188728.htmlTechArticle解释下,为什么LinearLayout在FrameLayout下面就会固定到底部,linearlayout底部 LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" androi...

相关文章

    暂无相关文章

用户评论

大家都在看