GithubHelp home page GithubHelp logo

bobcn2017 / threeitemstoolbar Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 161 KB

左中右三个位置的toolbar, Android开发可使用,左边可设置回退或其他,中间可以添加App图标和名字,右边是Button或者菜单。

Java 100.00%

threeitemstoolbar's Introduction

ThreeItemsToolbar

左中右三个位置的toolbar,左边可设置回退或其他,中间可以添加App图标和名字,右边是Button或者菜单。

显示效果:

image

以上toolbar中的图标、文字均可自主设定。同时保留Google Toolbar的功能,如在RecyclerView滚动时toolbar跟随向上消失,向下复现。

使用方式:

1、在Module的build.gradle中添加:

compile 'com.ff.pp.threeitemstoolbar:library:1.0.5'

2、在XML文件如下定义和使用:

    <com.ff.pp.threeitemstoolbar.ThreeItemsToolbar
    android:id="@+id/threeItemsToolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_gravity="top"
    android:background="#008899"
    app:leftButtonIsClose="true"
    app:centerIcon="@mipmap/ic_launcher_round"
    app:centerTitle="标题" />

其中属性leftButtonIsClose提供关闭当前Activity功能,可使用在App的非主界面Activity中,方便地提供回退功能。

3、同时也可以在代码中设置:

代码中除了正常设置左中右相应的图标、文字,还可以将右侧图标设置为菜单,传入相应的菜单Id及listener即可。

public void setRightSideMenu( int resId, PopupMenu.OnMenuItemClickListener listener)

4、注意需要在styles中设置:

 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

threeitemstoolbar's People

Contributors

zhangp365 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.