项目作者: openproject

项目描述 :
a common header bar to replace toolbar for android
高级语言: Java
项目地址: git://github.com/openproject/LessCode-HeaderBar.git
创建时间: 2017-02-23T10:09:57Z
项目社区:https://github.com/openproject/LessCode-HeaderBar

开源协议:

下载


Jcenter Status

LessCode-HeaderBar

a common header bar ui for android

Screenshot

Gradle

  1. compile('com.jayfeng:lesscode-lesscode:1.0');

Overview

  • 支持常见状态栏效果
  • 支持副标题
  • 支持阴影
  • 支持搜索
  • 支持弹窗
  • 使用非常简单

Usage

配置如下,

  1. HeaderBarConfig.getInstance()
  2. // header
  3. .headerHeight(DisplayLess.$dp2px(56))
  4. .headerBackgroundDrawable(new ColorDrawable(Color.parseColor("#1abc9c")))
  5. .headerBackIcon(R.drawable.app_back)
  6. .headerShadowDrawable(getResources().getDrawable(R.drawable.app_shadow))
  7. .headerShadowHeight(DisplayLess.$dp2px(16))
  8. // title
  9. .titleTextColor(Color.BLUE)
  10. .titleTextSize(24)
  11. .subtitleTextColor(Color.RED)
  12. // item
  13. .itemTextNormalColor(getResources().getColor(R.color.header_menu_text_normal_color))
  14. .itemTextPressedColor(getResources().getColor(R.color.header_menu_text_pressed_color))
  15. .itemTextSize(10)
  16. .itemBackgroudResource(R.drawable.app_item_bg_transparent)
  17. .build();

布局中定义HeaderBar,

  1. <com.jayfeng.lesscode.headerbar.HeaderBar
  2. android:id="@+id/headerbar"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content" ></com.jayfeng.lesscode.headerbar.HeaderBar>

除了全局配置之外,也可以为每个HeaderBar直接设置一些属性值,

  1. <declare-styleable name="HeaderBar">
  2. <attr name="hb_title_text_color" format="color" ></attr>
  3. <attr name="hb_title_text_size" format="dimension" ></attr>
  4. <attr name="hb_subtitle_text_color" format="color" ></attr>
  5. <attr name="hb_subtitle_text_size" format="dimension" ></attr>
  6. <attr name="hb_item_text_normal_color" format="color" ></attr>
  7. <attr name="hb_item_text_pressed_color" format="color" ></attr>
  8. <attr name="hb_item_text_size" format="dimension" ></attr>
  9. <attr name="hb_tab_bottom_background" format="color|reference" ></attr>
  10. <attr name="hb_height" format="dimension" ></attr>
  11. <attr name="hb_background" format="color|reference" ></attr>
  12. <attr name="hb_shadow" format="color|reference" ></attr>
  13. <attr name="hb_shadow_height" format="dimension" ></attr>
  14. </declare-styleable>

Author

Author weibo:冯建V mail:673592063@qq.com QQ:673592063

License

```
Copyright (C) LessCode Open Source Project

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.