リストのカスタム行ビューがあります。親と子の 2 つのコンポーネントがあるとします....子の高さを変更するときに、親の高さを一定に維持したい...
親の高さを一定に設定し、子の高さを動的に変化させます。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:background="#fff"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/child"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon" />
</RelativeLayout>
</LinearLayout>
そして実行時に、
child.setLayoutParams(new LayoutParams(30, x);
ここで、x は可変高変数です。それでも、親の高さは影響を受けています。解決策はありますか?