This repository has been archived by the owner on Aug 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
中文 README.md
燒餅 edited this page Jul 27, 2017
·
1 revision
Material Design 设计面包屑 (Breadcrumbs) 导航 Android 界面控件 (SDK 19+)
首先,加入这段代码在要使用的项目根目录的 build.gradle 中:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
再在你的应用模块中添加依赖:
dependencies {
compile 'moe.feng:BreadcrumbsView:latest-version'
}
在布局 XML 的适当位置放置 BreadcrumbsView
。
示例:
<android.support.design.widget.AppBarLayout...>
<android.support.v7.widget.Toolbar.../>
<moe.feng.common.view.breadcrumbs.BreadcrumbsView
android:id="@+id/breadcrumbs_view"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
当你的界面导航到下一步时,创建一个新的 BreadcrumbItem
并将它添加到 BreadcrumbsView
。
使用 removeItemAfter(int)
或 removeLastItem
来移除一些 Items 或最后一个 Item
你可以为 BreadcrumbsView
设置一个回调来接收 Item 点击/更改事件。
为了简化事件,我推荐使用 DefaultBreadcrumbsCallback
,它会为你处理好 Item 更改、删除 :
new DefaultBreadcrumbsCallback() {
@Override
public void onNavigateBack(BreadcrumbItem item, int position) {
// ...
}
@Override
public void onNavigateNewLocation(BreadcrumbItem newItem, int changedPosition) {
// ...
}
}
MIT License
Copyright (c) 2017 Fung Go (fython)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.