java向Android活动添加容器和操作栏。
我试图在顶部添加操作栏,在操作栏下方添加两个容器,每个容器的宽度分别为80%和20%
这是我的XML文件,它不工作:
<FrameLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:id="@+id/container"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context="com.example.hany_action_bar.MainActivity"
tools:ignore="MergeRootFrame" >
<LinearLayout
安卓:id="@+id/menu_container"
安卓:layout_width="0dp"
安卓:layout_height="fill_parent"
安卓:weightSum="20"
安卓:orientation="horizontal" >
</LinearLayout>
<LinearLayout
安卓:id="@+id/main_container"
安卓:layout_width="0dp"
安卓:layout_height="fill_parent"
安卓:weightSum="80"
安卓:orientation="horizontal" >
</LinearLayout>
</FrameLayout>
# 1 楼答案
你可以这样尝试: