【发布时间】:2013-09-12 12:32:56
【问题描述】:
我正在将方向从纵向更改为横向,从横向更改为纵向。我的代码如下
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"
我将相同的布局放在纵向布局文件夹和横向布局土地中,但是当我尝试旋转屏幕时,如果从纵向开始,则仍会从布局文件夹中获取布局。屏幕旋转但没有获得正确的文件夹来显示布局。请帮忙
【问题讨论】: