解释下,为什么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占用了最下面的70dp的高度,剩余的屏幕都属于framelayout了
用户评论