提供面包屑的Android导航条:HanselAndGretel

jopen 10年前

HanselAndGretel实现面包屑风格的fragment页面导航条,类似网页顶部的导航条。

用法

For a working implementation of this project see the sample/ folder.

  1. 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" />
  2. In your onCreate method, bind the widget to the activity.

    FragmentBreadCrumbs crumbs = (FragmentBreadCrumbs)findViewById(R.id.breadcrumbs);  crumbs.setActivity(this);
  3. 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.

  4. (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);
提供面包屑的Android导航条:HanselAndGretel

项目主页:http://www.open-open.com/lib/view/home/1390735928789