在myfragment.java變化方向不會炒鍋中com.android.support:design:23.2.0
@Override
public void onConfigurationChanged(Configuration newConfig) {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
if (isScreenChange()) {
recyclerView.setLayoutManager(staggeredGridLayoutManager);
} else {
recyclerView.setLayoutManager(linearLayoutManager);
}
}
public boolean isScreenChange() {
Configuration mConfiguration = getResources().getConfiguration();
Log.i("SCREEN",mConfiguration.toString());
int ori = mConfiguration.orientation;
if (ori == Configuration.ORIENTATION_LANDSCAPE) {
return true;
} else if (ori == Configuration.ORIENTATION_PORTRAIT) {
return false;
}
return false;
}
它劑量編譯「com.android.support:design:23.1.1的工作, 但在com.android.support:design:23.2.0,whatever你旋轉屏幕, 它總是顯示ORIENTATION_PORTRAIT
調用'compile'com.android.support:design:23.1.0'' –