public interface

ViewBinding

 androidx.viewbinding.ViewBinding

Subclasses:

ViewDataBinding

Gradle dependencies

compile group: 'androidx.databinding', name: 'viewbinding', version: '8.8.0-alpha01'

  • groupId: androidx.databinding
  • artifactId: viewbinding
  • version: 8.8.0-alpha01

Artifact androidx.databinding:viewbinding:8.8.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

A type which binds the views in a layout XML to fields.

Summary

Methods
public ViewgetRoot()

Returns the outermost View in the associated layout file.

Methods

public View getRoot()

Returns the outermost View in the associated layout file. If this binding is for a layout, this will return the first view inside of the merge tag.

Source

/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.viewbinding;

import android.view.View;
import androidx.annotation.NonNull;

/** A type which binds the views in a layout XML to fields. */
public interface ViewBinding {
    /**
     * Returns the outermost {@link View} in the associated layout file. If this binding is for a
     * {@code <merge>} layout, this will return the first view inside of the merge tag.
     */
    @NonNull
    View getRoot();
}