移动到上一个片段而不重新加载,同时单击当前片段的后退按钮

时间:2015-05-05 11:36:54

标签: android android-fragments android-fragmentactivity

我有两个片段。示例FragmentOne和FragmentTwo。在我的     FragmentOne有地图,标记和一个布局。最初的布局状态是     无形。当我点击标记时,一个布局在同一个中可见     分段。当我点击布局时,点击事件会重定向到另一个     片段名称称为FragmentTwo。

now i am in FragmentTwo. my FragmentTwo have a back Button. when i click a 
back button i need to move to FragmentOne. it is working fine. but the 
FragmentOne  shows only the map and marker. i can't able to see the layout.

i need to move from FragmentTwo to FragmentOne. without reloading   
FragmentOne.

 i Mean i need to see the Map,marker and layout in 
 FragmentOne while redirect from FragmentTwo.
 I am new from fragment side. so please help me. Thanks in advance.
 i need to move from FragmentTwo to FragmentOne. without reloading   
 FragmentOne.
 i Mean i need to see the Map,marker and the list item(popup) in my 
  FragmentOne while Transaction from FragmentTwo.

 I am new from fragment side. so please help me. Thanks in advance.

//////////////////////////////////////////////////////////////////////////////// 
   I have a two fragment. example FragmentOne and FragmentTwo. in my
FragmentOne have map,markers and one layout. initially the layout state is 
invisible. when i click the marker one layout is visible in the same  
fragment. when i click the layout the click event redirect to another 
fragment name called FragmentTwo.

now i am in FragmentTwo. my FragmentTwo have a back Button. when i click a 
back button i need to move to FragmentOne. it is working fine. but the 
FragmentOne  shows only the map and marker. i can't able to see the layout.

i need to move from FragmentTwo to FragmentOne. without reloading   
FragmentOne.

 i Mean i need to see the Map,marker and layout in 
 FragmentOne while redirect from FragmentTwo.
 I am new from fragment side. so please help me. Thanks in advance.
 i need to move from FragmentTwo to FragmentOne. without reloading   
 FragmentOne.
 i Mean i need to see the Map,marker and the list item(popup) in my 
  FragmentOne while Transaction from FragmentTwo.

 I am new from fragment side. so please help me. Thanks in advance.





 i need to move from FragmentTwo to FragmentOne. without reloading   
 FragmentOne.

 i Mean i need to see the Map,marker and the list item(popup) in my 
  FragmentOne while Transaction from FragmentTwo.

 I am new from fragment side. so please help me. Thanks in advance.

1 个答案:

答案 0 :(得分:0)

将状态保存在全局变量或其他持久数据中,然后在onResume()中重新加载。 在任何时候Android S.O.将需要卸载片段1,因为建议以这种方式进行。