提供面包屑的Android导航条:HanselAndGretel
jopen
11年前
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);