A banner displays a prominent message and related optional actions.
in your layout.xml
<com.cesar.materialcomponents.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ccc"
app:bannerBackgroundColor="@color/weird_green"
app:contentText="Your password was updated on another device. Please sign in again"
app:leftButtonText="Continue as Guest"
app:rightButtonText="Sign in"/>
In your activity.kt
banner.setLeftButtonAction { banner.dismiss() }
banner.setRightButtonAction { navigator.goToSignIn() }
Just add the following dependency in your app's build.gradle
allprojects { repositories { maven { url 'https://jitpack.io' } }}
dependencies {
implementation 'com.github.cesarferreira:MaterialComponent.Banner:{latest_version}'
}