小弟在开发中碰到一问题,百思不得其解,业务逻辑是这样的,我在activity中的布局是viewpager和RadioGroup底部菜单,viewpager中填充的是fragment,fragment中有需要跳转另一个fragment,replace新的fragment时,没有覆盖全部的布局,底部的RadioGroup跑到现在fragment的上面了,activity中布局代码
-
<?xml version="1.0" encoding="utf-8"?>
android:id="@+id/ll_home2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" ><android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center"/>
android:id="@+id/main_radio"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:background="@drawable/bottom_tab_bg"
android:orientation="horizontal"
android:paddingTop="2dp"
><RadioButton android:id="@+id/rb_function" style="@style/main_tab_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/icon_function" android:text="@string/tab_function" /> <RadioButton android:id="@+id/rb_orderform" style="@style/main_tab_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/icon_orderform" android:text="@string/tab_orderform" /> <RadioButton android:id="@+id/rb_user" style="@style/main_tab_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/icon_user" android:text="@string/tab_user" />
当我点击listview中的item时要跳转界面
代码是这个
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.ll_home,restaurantContentFragment , "fragment_restaurant");
transaction.addToBackStack("fragment_restaurant");
transaction.commit();
跳转到的fragment布局代码是这样的
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<TextView
android:id="@+id/tv_restaurant_title"
android:layout_width="fill_parent"
android:layout_height="55dip"
android:background="#99FF6600"
android:gravity="center"
android:text="风味大酒店"
android:textSize="22dp" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/tv_restaurant_title"
android:layout_marginBottom="30dip" >
<RelativeLayout
android:id="@+id/rl_resaurant_info_loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<ProgressBar
android:id="@+id/pb_resaurant_info_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_resaurant_info_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/pb_resaurant_info_loading"
android:text="正在加载" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/ll_restaurant_info_class"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#123456"
android:orientation="vertical" >
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="全部类别"
android:textColor="@drawable/rbn_bg"/>
</LinearLayout>
<ListView
android:id="@+id/lv_menu"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3" >
</ListView>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/ll_resaurant_info_bottom"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_weight="3"
android:gravity="center"
android:text="已选xxx项,共xxx元"
android:textColor="#aa0000" />
<TextView
android:id="@+id/tv_takeorder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_weight="1"
android:text="去下单→"
android:textColor="#aa0000"
android:textSize="18dp" />
</LinearLayout>