我有一个带有GLSurfaceView的活动:
public class MainActivity extends ActionBarActivity {
private View mDecorView;
private GLSurfaceView mGLSurfaceView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mDecorView = getWindow().getDecorView();
mGLSurfaceView = new GLSurfaceView(this);
mGLSurfaceView.setEGLContextClientVersion(2);
mGLSurfaceView.setRenderer(new MyRenderer(getAssets()));
setContentView(mGLSurfaceView);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
return id == R.id.action_settings || super.onOptionsItemSelected(item);
}
@Override
protected void onPause() {
super.onPause();
mGLSurfaceView.onPause();
}
@Override
protected void onResume() {
super.onResume();
mGLSurfaceView.onResume();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}
}
没有什么复杂的,我只是隐藏状态,菜单栏和导航栏,我还以横向模式锁定活动。但是,每当应用程序在纵向模式下保持焦点时,我会在logcat中获得 W / IInputConnectionWrapper:showStatusIcon on inactive InputConnection 。我正在使用Android Studio。这是由什么造成的,我该如何解决?
另外,由于我不使用任何菜单,我应该删除onCreateOptionsMenu和onOptionsItemSelected函数吗?如果我不使用操作栏,我应该从Activity而不是ActionBarActivity扩展吗?我看到人们从FragmentActivity扩展,但我还没有使用片段,我也不知道它们的用途。什么是最好的父类??