我开发了一个不需要传感器的应用程序。
为此我使用,
清单文件中的android:screenOrientation="nosensor"。
但是,在我打开滑块时在滑动设备中它不起作用。所以请给我一些解决方案。
我开发了一个不需要传感器的应用程序。
为此我使用,
清单文件中的android:screenOrientation="nosensor"。
但是,在我打开滑块时在滑动设备中它不起作用。所以请给我一些解决方案。
您可以查看 android:configChanges 属性。通过调用 android:configChanges="keyboardHidden" 您可以自己处理键盘更改(通过 onConfigurationChanged 方法)。
添加 configChanges 并使用 onConfigurationChanged
<activity
android:name=".ABC"
android:configChanges="orientation|keyboardHidden|screenSize"
>
</activity>
配置更改功能被覆盖:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main);
}
添加所有三个并检查它。screenSize 是从 API13 添加的,是捕捉滑块方向变化所必需的。