Tôi muốn có bố cục ứng dụng như bố cục được sử dụng cho Gmail. Họ có thanh tác vụ có biểu tượng (trên thiết bị của tôi có biểu tượng ứng dụng để điều hướng và chế độ xem tùy chỉnh để chọn hộp thư đến/hộp thư đến ưu tiên), nhưng cũng có một số loại phân tách ActionBar
vì ở dưới cùng tôi có một số biểu tượng (soạn, tìm kiếm, nhãn, v.v.).Hiển thị màn hình ActionBar tách hai lần với nhiều biểu tượng
Tôi làm cách nào để thực hiện việc này? Tôi đã thực hiện các ActionBar
sau thông qua XML này:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_gps"
android:icon="@drawable/icone_gps_continu"
android:showAsAction="always"
android:title="@string/menu_gps"/>
<item
android:id="@+id/menu_sort"
android:icon="@drawable/icone_liste_chron"
android:showAsAction="always"
android:title="@string/menu_liste"/>
<item
android:id="@+id/menu_stats"
android:icon="@drawable/icone_statistiques"
android:showAsAction="always"
android:title="@string/menu_stats"/>
<item
android:id="@+id/menu_save"
android:icon="@drawable/icone_terminersortie"
android:showAsAction="always"
android:title="@string/menu_save"/>
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_launcher"
android:showAsAction="always"
android:title="@string/menu_search"/>
<item
android:id="@+id/menu_photo"
android:icon="@drawable/icone_enregistrerphoto"
android:showAsAction="always"
android:title="@string/menu_photo">
</item>
<item
android:id="@+id/menu_sound"
android:icon="@drawable/icone_enregistrerson"
android:showAsAction="always"
android:title="@string/menu_sound">
</item>
<item
android:id="@+id/menu_settings"
android:icon="@drawable/icone_parametres"
android:showAsAction="always"
android:title="@string/menu_settings">
</item>
</menu>
Và tôi có tất nhiên kích hoạt sự chia rẽ ActionBar
bằng cách thêm android:uiOptions="splitActionBarWhenNarrow"
để <application>
thẻ của tôi trong biểu hiện.
Những gì tôi nhận được là một "hàng đầu" trống ActionBar
; và phần dưới chỉ hiển thị ba biểu tượng. Tôi nghĩ tôi có thể hiển thị như 3-4 biểu tượng ở trên cùng và 5 ở phía dưới ở chế độ chờ, và tất cả chúng ở trên cùng ở chế độ ngang.
Lưu ý: ngay cả khi tôi đang thử nghiệm trên ICS với Galaxy Nexus, tôi đang sử dụng ActionBarSherlock để cung cấp khả năng tương thích ngược.