SmartToolbar

Provide with more customizable to your Toolbar

License

License

GroupId

GroupId

com.github.chivorns
ArtifactId

ArtifactId

smarttoolbar
Last Version

Last Version

1.0.12
Release Date

Release Date

Type

Type

aar
Description

Description

SmartToolbar
Provide with more customizable to your Toolbar
Project URL

Project URL

https://github.com/Chivorns/SmartToolbar
Source Code Management

Source Code Management

https://github.com/Chivorns/SmartToolbar

Download smarttoolbar

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.chivorns/smarttoolbar/ -->
<dependency>
    <groupId>com.github.chivorns</groupId>
    <artifactId>smarttoolbar</artifactId>
    <version>1.0.12</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.chivorns/smarttoolbar/
implementation 'com.github.chivorns:smarttoolbar:1.0.12'
// https://jarcasting.com/artifacts/com.github.chivorns/smarttoolbar/
implementation ("com.github.chivorns:smarttoolbar:1.0.12")
'com.github.chivorns:smarttoolbar:aar:1.0.12'
<dependency org="com.github.chivorns" name="smarttoolbar" rev="1.0.12">
  <artifact name="smarttoolbar" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.chivorns', module='smarttoolbar', version='1.0.12')
)
libraryDependencies += "com.github.chivorns" % "smarttoolbar" % "1.0.12"
[com.github.chivorns/smarttoolbar "1.0.12"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

SmartToolbar

Download

Customize your toolbar with beautiful style for your Android project

Functionalities support

  • Support center titleText and titleIcon
  • Support change left and right button icon
  • Support change background with color code and drawable with image, normal selector and gradient
  • Support change visibility of left button , right button and title icon
  • Support using with CoordinatorLayout to handle scroll event
  • Supprot custom status bar with gradient color
  • Automatically hide original actionbar
  • No need to call showing method
  • Easy to use

Usage

1. Add the dependencies to your gradle file:

dependencies {
    implementation 'com.github.chivorns:smarttoolbar:1.0.12'
}

2. Add SmartToolbar to your layout:

2.1 Simple layout with default value

<com.chivorn.smarttoolbar.SmartToolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="50dp" />

2.2 More attributes

<com.chivorn.smarttoolbar.SmartToolbar
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="@color/colorPrimary"
    app:smtb_leftBtnIcon="@drawable/ic_arrow_back_white_24dp"
    app:smtb_rightBtnIcon="@drawable/ic_close_white_24dp"
    app:smtb_showLeftBtn="true"
    app:smtb_showRightBtn="true"
    app:smtb_showTitleIcon="false"
    app:smtb_titleColor="#f1ecec"
    app:smtb_titleIcon="@drawable/title_icon"
    app:smtb_titleText="Sample Title Text"
    app:smtb_statusBarColor="@drawable/smart_toolbar_bg_gradient"
    app:smtb_titleTextSize="15sp"
    app:smtb_leftBtnIconWidth="50dp"
    app:smtb_leftBtnIconHeight="30dp"
    app:smtb_rightBtnIconWidth="50dp"
    app:smtb_rightBtnIconHeight="30dp"
    app:smtb_titleIconWidth="50dp"
    app:smtb_titleIconHeight="30dp"/>

3. Update at runtime

3.1 Using Java

// TODO: setTitleText
   smartToolbar.setTitleText("New Title Text");
// TODO: setTitleTextColor
   smartToolbar.setTitleTextColor(getResources().getColor(R.color.colorAccent)); // or
   smartToolbar.setTitleTextColor(Color.YELLOW);
// TODO: setShowTitleIcon & setTitleIcon
   smartToolbar.setShowTitleIcon(true);
   smartToolbar.setTitleIcon(getResources().getDrawable(R.drawable.ic_close_white_24dp));
// TODO: setBackgroundColor & setBackgroundDrawable
   smartToolbar.setBackground(getResources().getDrawable(R.drawable.smart_toolbar_bg_gradient)); // or
   smartToolbar.setBackgroundColor(Color.YELLOW);
// TODO: setVisibility of left and right button
   smartToolbar.setShowLeftButton(true);
   smartToolbar.setShowRightButton(true);
// TODO: setIcon to left and right button
   smartToolbar.setLeftButtonIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp));
   smartToolbar.setRightButtonIcon(getResources().getDrawable(R.drawable.ic_close_white_24dp));
// TODO: show custom status bar
   smartToolbar.showCustomStatusBar(this);
// TODO: set status bar color
   smartToolbar.setStatusBarColor(getResources().getDrawable(R.drawable.smart_toolbar_bg_gradient)); // or
   smartToolbar.setStatusBarColor(Color.BLUE);
// TODO: Set title text size
   smartToolbar.setTitleTextSize(15);
// TODO: Set layout width & height for left button
   smartToolbar.setLeftButtonIconWidth(50);
   smartToolbar.setLeftButtonIconHeight(30);
// TODO: Set layout width & height for right button
   smartToolbar.setRightButtonIconWidth(50);
   smartToolbar.setRightButtonIconHeight(30);
// TODO: Set layout width & height for title icon
   smartToolbar.setTitleIconWidth(50);
   smartToolbar.setTitleIconHeight(30);

3.2 Using Kotlin

// TODO: setTitleText
   smartToolbar?.setTitleText("New Title Text")
// TODO: setTitleTextColor
   smartToolbar?.setTitleTextColor(resources.getColor(R.color.colorAccent)) // or
   smartToolbar?.setTitleTextColor(Color.YELLOW)
// TODO: setShowTitleIcon & setTitleIcon
   smartToolbar?.setShowTitleIcon(true)
   smartToolbar?.setTitleIcon(resources.getDrawable(R.drawable.ic_close_white_24dp))
// TODO: setBackgroundColor & setBackgroundDrawable
   smartToolbar?.background = resources.getDrawable(R.drawable.smart_toolbar_bg_gradient) // or
   smartToolbar?.setBackgroundColor(Color.YELLOW)
// TODO: setVisibility of left and right button
   smartToolbar?.setShowLeftButton(true)
   smartToolbar?.setShowRightButton(true)
// TODO: setIcon to left and right button
   smartToolbar?.setLeftButtonIcon(resources.getDrawable(R.drawable.ic_arrow_back_white_24dp))
   smartToolbar?.setRightButtonIcon(resources.getDrawable(R.drawable.ic_close_white_24dp))
// TODO: show custom status bar
   smartToolbar?.showCustomStatusBar(this);
// TODO: set status bar color
   smartToolbar?.setStatusBarColor(getResources().getDrawable(R.drawable.smart_toolbar_bg_gradient)); // or
   smartToolbar?.setStatusBarColor(Color.BLUE);
// TODO: Set title text size
   smartToolbar?.setTitleTextSize(15);
// TODO: Set layout width & height for left button
   smartToolbar?.setLeftButtonIconWidth(50);
   smartToolbar?.setLeftButtonIconHeight(30);
// TODO: Set layout width & height for right button
   smartToolbar?.setRightButtonIconWidth(50);
   smartToolbar?.setRightButtonIconHeight(30);
// TODO: Set layout width & height for title icon
   smartToolbar?.setTitleIconWidth(50);
   smartToolbar?.setTitleIconHeight(30);

Versions

Version
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2