我正在做从纵向到横向以及从横向到纵向的方向更改。我的代码如下
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
//Set titlebar as "my@heaven"
getSherlockActivity().getSupportActionBar()
.setBackgroundDrawable(getResources().getDrawable(R.drawable.myheaven));
view = inflater.inflate(R.layout.memorial_listing, container, false);
setUpView(savedInstanceState);
return view;
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
}
}
我也将其添加到清单中
android:configChanges="orientation|keyboardHidden|screenSize"
并且我将相同的布局放置在纵向布局文件夹和横向布局土地中,但是当我尝试旋转屏幕时,如果从纵向开始,则仍会从布局文件夹中获取布局。屏幕旋转但没有获得正确的文件夹来显示布局。请帮忙