android - How to set Layoutparams of child view without affecting parent view? -


i have custom row view list. there 2 components parent , child....i want maintain height of parent constant when change height of child...

i have set parent height constant , height of child varied dynamically.

<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> 

and during runtime,

child.setlayoutparams(new layoutparams(30, x); 

where x varying height variable. still height of parent getting affected. solutions?

if linearlayout root view, when inflating params android:layout_width , android:layout_height changed android, if row inside list, have width match_parent , height wrap_content. if want keep constant height row have set layout params programatically after inflate view.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -