Architecture Components in Android
ViewBinding View binding is a feature that allows you to more easily write code that interacts with views. Once view binding is enabled in a module, it generates a binding class for each XML layout file present in that module. In most cases view binding replaces findViewById Setup instructions View binding is enabled on a module by module basis. To enable view binding add the following code in build.gradle (Module) file. buildFeatures { viewBinding true } If you want a layout file to be ignored while generating binding classes, add the following attribute to the root view of that layout file. < RelativeLayout xmlns: android ="http://schemas.android.com/apk/res/android" xmlns: tools ="http://schemas.android.com/tools" android :id ="@+id/RelativeLayout01" android :layout_width ="wrap_content" android :layout_height ="wrap_content" tools :viewBindingIgnore ="true" > </ RelativeLayout > Usa...
Comments
Post a Comment