我想在頂部添加動作條,並在動作條下面添加兩個容器,每個容器都有80%的寬度和20%的寬度。將容器和操作欄添加到Android活動。
這裏是一個不工作我的XML文件:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hany_action_bar.MainActivity"
tools:ignore="MergeRootFrame" >
<LinearLayout
android:id="@+id/menu_container"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:weightSum="20"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="@+id/main_container"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:weightSum="80"
android:orientation="horizontal" >
</LinearLayout>
</FrameLayout>
什麼是 「不工作」 是什麼意思? – Emmanuel
改變'weightSum'爲'weight' – Blundell
而不是'android:weightSum =「20」/「80」'使用'android:weight =「20」/「80」' – Onik