Próbuję w ten sposób:
fragment_container.layoutParams.height = 100
fragment_container.requestLayout()
oraz w ten:
val params = fragment_container.layoutParams
params.height = 100
fragment_container.layoutParams = params
fragment_container.requestLayout()
żaden z nich nie działa. Wysokość tego fragment_container (to FrameLayout) jest wciąż taka sama jak zadeklarowana w layout.xml
W razie W zamieszczam też layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<pl.jawegiel.exchangerates.ClickableMotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto"
android:id="@+id/motion_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
motion:layoutDescription="@xml/main_activity_scene">
<ImageView
android:id="@+id/iv_header"
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="@mipmap/exchange_rates"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/ll_toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/teal_700"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="8dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toBottomOf="@+id/iv_header">
<RelativeLayout
android:id="@+id/rl_inside_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/toolbar_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar_title"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="400dp"/>
<TextView
android:id="@+id/about"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:text="@string/about"
android:layout_marginEnd="10dp"
android:textSize="18sp"
android:visibility="visible"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</pl.jawegiel.exchangerates.ClickableMotionLayout>
Z góry dziękuję! :)