Can';t动态更改Nestedscrollview的布局参数(android)

Can';t动态更改Nestedscrollview的布局参数(android),android,Android,我想动态更改嵌套滚动视图的高度。但是我得到了致命错误。基本上这是一张底片,我想在它处于展开状态之前更改高度 我的Java代码: 我的布局是: 有人有什么建议吗?我自己也得到了答案 bottomsheet_nestedscrollview = (NestedScrollView) findViewById(R.id.bottom_sheet_landing_screen); RelativeLayout.LayoutParams params = (RelativeLayout.L

我想动态更改嵌套滚动视图的高度。但是我得到了
致命错误
。基本上这是一张底片,我想在它处于展开状态之前更改高度

我的Java代码:

我的布局是:


有人有什么建议吗?

我自己也得到了答案

    bottomsheet_nestedscrollview = (NestedScrollView) findViewById(R.id.bottom_sheet_landing_screen);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) bottomsheet_nestedscrollview.getLayoutParams();
    params.height = bottom_relativeLayout.getHeight();
    bottomsheet_nestedscrollview.setLayoutParams(params);
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.csm.hptcp.hptcpmobileapp.Landing_Screen">

<include layout="@layout/content_landing__screen" />

<android.support.v4.widget.NestedScrollView
    android:id="@+id/bottom_sheet_landing_screen"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/holo_orange_light"
    android:clipToPadding="true"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <include layout="@layout/landing_screen_bottomsheet" />

</android.support.v4.widget.NestedScrollView>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_dialog_email"
    app:layout_anchor="@id/bottom_sheet_landing_screen"
    app:layout_anchorGravity="top|center" />

</android.support.design.widget.CoordinatorLayout>
FATAL EXCEPTION: main
Process: com.csm.hptcp.hptcpmobileapp, PID: 16854
java.lang.ClassCastException: android.support.design.widget.CoordinatorLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
    bottomsheet_nestedscrollview = (NestedScrollView) findViewById(R.id.bottom_sheet_landing_screen);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) bottomsheet_nestedscrollview.getLayoutParams();
    params.height = bottom_relativeLayout.getHeight();
    bottomsheet_nestedscrollview.setLayoutParams(params);