2011-11-02 68 views
0

我有两种不同的布局,像layout-land layout-port这样的活动,具有不同的设计。我已经给出了下面的代码,但状态保持不变,但是potrait设计正在进入横向模式。任何人都可以告诉我如何避免这种情况?任何人都可以提供示例代码吗?保留状态不工作在android

我提到的android:configChanges = “方向”

@Override 
protected void onSaveInstanceState(Bundle outState) { 
    super.onSaveInstanceState(outState); 
    outState.putInt("bufferedPercentage", video.getBufferPercentage()); 
    commentWebView.saveState(outState); 


    //Toast.makeText(this, "Activity state saved", Toast.LENGTH_LONG).show(); 
} 



if(savedInstanceState!=null) 
{ 
    commentWebView.restoreState(savedInstanceState); 
} 

回答

1

删除android:configChanges="orientation"和不提任何screen orientation也。

这将工作

希望它有帮助。