This is what i need: in one fragment, i have two buttons, by toggling those two buttons, the page will show different contents(both will be from layout files). My layout file: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/grey" > <Button android:id="@+id/btn0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.69" android:background="@color/dark_grey" android:text="Button 0" /> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.51" android:text="Button1" /> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/details"/> </LinearLayout> </LinearLayout> java code: (only list one button is clicked) final RelativeLayout detailsLayout = (RelativeLayout)view.findViewById(R.id.details); btn0.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { *View child = getActivity().getLayoutInflater().inflate(R.layout.content1, container, false);* * detailsLayout .addView(child);// This is right?* return; } }); Questions: 1. when the detail content got inflated, the buttons got squeezed to the left side. (previous on top of the page) 2. when another button was clicked, the content got overlapped. how to solve this? Thanks a lot!!! -- -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.