Layout Behaviors


#1

I want to use the Google Material Design Concept called “Bottom Sheet”. I am attempting to implement this as a plugin but I cannot seem to set a layout behavior. It seems that the suggested way by the Android documentation is use LayoutParams and call setBehavior. I have tried the following code but it I get an error message that CoordinatorLayoutParams cannot be cast to CommonLayoutParams.

private _android: any;

    public createNativeView(): any {
       this._android = new android.support.design.widget.CoordinatorLayout(this._context);
        return this._android;
    }

    public onLoaded() {
        super.onLoaded();
        try {
            let params = this._android.getLayoutParams();
            let coordp = new android.support.design.widget.CoordinatorLayout.LayoutParams(params);
            coordp.setBehavior(new android.support.design.widget.BottomSheetBehavior());
            this._android.setLayoutParams(coordp);
        }
        catch (ex) {
            console.log(ex);
        }
    }

#2

Did you get around to working on this?