Skip to content

Dragote/view-binding-delegate

Repository files navigation

Android ViewBinding Library

Version

A library that makes Android View Binding usage easier.

It supports extensions for:

  • Activity
  • Fragment (DialogFragment e.t.c)
  • ViewHolder

How to use?

  1. Create binding in your Activity/Fragment/ViewHolder
private val binding by viewBinding(MainFragmentBinding::bind)

* MainFragmentBinding is the generated binding class for your 'main_fragment.xml' layout file

  1. Use it to interact with views
binding.titleText.isVisible = true
binding.someButton.setOnClickListener { ... }

How to install?

  1. Enable ViewBinding in build.gradle of your project/module:
android {
    //...//
    buildFeatures {
        viewBinding true
    }
    //...//
}
  1. Add it in your settings.gradle:
dependencyResolutionManagement {
    //..//
    repositories {
        //..//
        maven { url 'https://jitpack.io' }
        //..//
    }
}
  1. Add the dependency in build.gradle of your project/module:
dependencies {
    //..//
    implementation 'com.github.dragote:view-binding-delegate:1.0'
    //..//
}

About

A library that makes Android View Binding usage easier.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages