提供面包屑的Android導航條:HanselAndGretel
HanselAndGretel實現面包屑風格的fragment頁面導航條,類似網頁頂部的導航條。
用法
For a working implementation of this project see the sample/
folder.
-
Include the widget in your view. This should usually be placed directly above the container in which the associated fragments will be displayed.
<android.support.v4.app.FragmentBreadCrumbs android:id="@+id/breadcrumbs" android:layout_width="fill_parent" android:layout_height="40dp" />
-
In your
onCreate
method, bind the widget to the activity.FragmentBreadCrumbs crumbs = (FragmentBreadCrumbs)findViewById(R.id.breadcrumbs); crumbs.setActivity(this);
-
Add the required style attributes to your theme.
<item name="hagDividerVertical">@drawable/hag__divider_dark</item> <item name="hagSelectableItemBackground">@drawable/hag__background_dark</item>
or
<item name="hagDividerVertical">@drawable/hag__divider_dark</item> <item name="hagSelectableItemBackground">@drawable/hag__background_dark</item>
or specify your own drawables for the divider and background.
-
(Optional) Set the title of the initial view. This can be useful when the initial activity view has a default fragment.
//continued from above crumbs.setTitle("Settings", null);

本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!