80,493
社区成员
发帖
与我相关
我的任务
分享<?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="horizontal" >
<fragment class="com.xuzhi.fragment.FragmentDemoActivity$TitlesFragment" android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent"
/>
<FrameLayout android:id="@+id/details" android:layout_weight="1" android:layout_width="0px" android:layout_height="match_parent"
android:background="?android:attr/detailsElementBackground"
></FrameLayout>
</LinearLayout>@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
FragmentManager fm = this.getFragmentManager();
DetailsFragment df = (DetailsFragment)fm.findFragmentById(R.id.details);
FragmentTransaction ft = fm.beginTransaction();
ft.hide(df);
ft.commit();
return super.onOptionsItemSelected(item);
}