This is completely untested code, but should work (with some typos fixed): -First wrap the fragment in a FrameLayout like this:
<FrameLayout android:id="@+id/fragMenuFrame" android:layout_width="200dp" android:layout_height="match_parent" > <fragment android:id="@+id/fragMenu" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/GREY" class="com.viettel.vinamilk.view.main.ListFrag" /> </FrameLayout> -Then get hold of the container with findViewById, and get the LayoutParams. Note that when casting to a more specific class, use the parent LayoutParams class, not FrameLayout.LayoutParams... ViewGroup.LayoutParams params = menuFrame.getLayoutParams(); params.width = ViewGroup.FILL_PARENT; requestLayout(); Sexta-feira, 8 de Junho de 2012 8:15:28 UTC+1, Huynh Ngoc Bang escreveu: > > Hi everyone! > I have layout same as: > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:background="@color/WHITE" > android:orientation="horizontal" > > > <fragment > android:id="@+id/fragMenu" > android:layout_width="200dp" > android:layout_height="match_parent" > android:background="@color/GREY" > class="com.viettel.vinamilk.view.main.ListFrag" /> > > <FrameLayout > android:id="@+id/fragDetail" > android:layout_width="0px" > android:layout_height="match_parent" > android:layout_weight="1"/> > > </LinearLayout> > > > > I would like to resize fragment (id = fragMenu) when runing app. > Who can help me! > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en