我想在我的活動頂部添加操作欄。如何在以下佈局中添加操作欄。 我想創建API級別小於11的操作欄。任何人都可以爲我提供該教程的參考。如何添加操作欄
佈局 -
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/buddha"
android:gravity="center"
android:orientation="vertical"
>
<View
android:id="@+id/top1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@null"
android:gravity="center"
android:layout_weight="5"
/>
<Button
android:id="@+id/hist"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="#73000000"
android:gravity="center"
android:textSize="@dimen/btxt"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:layout_weight="1"
android:text="@string/his"
/>
<View
android:id="@+id/top2"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@null"
android:gravity="center"
android:layout_weight=".10"
/>
<Button
android:id="@+id/typ"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:gravity="center"
android:background="#73000000"
android:textSize="@dimen/btxt"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:layout_weight="1"
android:text="@string/typ"
/>
<View
android:id="@+id/top3"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@null"
android:gravity="center"
android:layout_weight=".10"
/>
<Button
android:id="@+id/ben"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="1"
android:textSize="@dimen/btxt"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:background="#73000000"
android:text="@string/ben"
/>
<View
android:id="@+id/top4"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@null"
android:gravity="center"
android:layout_weight=".10"
/>
<Button
android:id="@+id/exit"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:gravity="center"
android:textSize="@dimen/btxt"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:background="#73000000"
android:layout_weight="1"
android:text="@string/exit"
/>
<View
android:id="@+id/top41"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@null"
android:gravity="center"
android:layout_weight=".10"
/>
</LinearLayout>
嘗試[actionbarsherlock(http://actionbarsherlock.com/) – CRUSADER
我使用的支持庫。 –
查看上面提供的鏈接中的示例部分,您將瞭解如何在您的應用中添加actionbarsherlock – CRUSADER