0
我使用呼叫片段寬度從另一個片段
LinearLayout formLayout = (LinearLayout)findViewById(R.id.mainLayout);
formLayout.removeAllViews();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
PatientSearch fragment = new PatientSearch(maincontrolActivity.this);
fragmentTransaction.add(R.id.mainLayout,fragment, "MY_FRAG");
fragmentTransaction.commit();
在PatientSearch
調用Fragment
佈局我有按鈕,我希望當點擊加載另一個Fragment
但老Fragment
的boundry內。
任何想法如何做到這一點?
你可以給出更多的示例代碼 – AMH
這部分文檔介紹了這個過程。示例代碼實現了多窗格佈局,左側窗格爲列表視圖,右側窗格爲詳細信息視圖。每次按下左窗格中的列表項時,詳細信息片段都會更改。這是通過對活動的回調事件完成的,如下所述:http://developer.android.com/guide/components/fragments.html#EventCallbacks –
再次讀取*整個*文檔,只是爲了完全理解碎片和他們的目的,也將極大地幫助你理解 –