相关疑难解决方法(0)

没有调用Android onConfigurationChanged

告诉Android onCreate()在方向改变时不打电话我遇到了麻烦.我已经添加android:configChanges="orientation"到我的清单中但仍然onCreate()调用了方向更改.这是我的代码.

AndroidManifest.xml中

<activity android:name="SearchMenuActivity" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="orientation"></activity>
Run Code Online (Sandbox Code Playgroud)

SearchMenuActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Set the current layout to the search_menu
    setContentView(R.layout.search_menu_activity);

    Log.d(TAG, "onCreate() Called");
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
    //don't reload the current page when the orientation is changed
    Log.d(TAG, "onConfigurationChanged() Called");
    super.onConfigurationChanged(newConfig);
}
Run Code Online (Sandbox Code Playgroud)

和我的LogCat输出

06-23 12:33:20.327: DEBUG/APP(2905): onCreate() Called
//Orientation Changes
06-23 12:33:23.842: DEBUG/APP(2905): onCreate() Called
Run Code Online (Sandbox Code Playgroud)

有谁知道我做错了什么?谢谢.

java configuration android orientation

40
推荐指数
4
解决办法
5万
查看次数

标签 统计

android ×1

configuration ×1

java ×1

orientation ×1