草庐IT

ORIENTATION_ROTATE

全部标签

java - 如何防止绑定(bind)服务在 Activity 的运行时更改时被破坏(例如 : orientation)

我有一个绑定(bind)服务。一个Activity正在绑定(bind)它。它在Activity的onStop()方法上取消绑定(bind)服务。问题是,如果Activity发生运行时更改(例如,方向更改),则会重新创建Activity。因此,从Activity调用onStop()方法,并且Activity在该方法中解除绑定(bind)Service,这导致Service销毁(并重新启动它)。我想防止服务在运行时更改中被破坏,同时在Activity不可见时保持服务停止。您可以说尝试startService()但它使服务在Activity不可见时不会停止。如果我添加stopServiceA

android - 当 DialogFragment 位于顶部时,Orientation Change 出现 InstantiationException

我的Fragment类中有一个DialogFragment定义为inner类。在OrientationChange上,甚至会弹出以下异常:Causedby:android.app.Fragment$InstantiationException:Unabletoinstantiatefragmentmy.package.fragments.ImportFragment$FailedImportDialog:makesureclassnameexists,ispublic,andhasanemptyconstructorthatispublicatandroid.app.Fragment.

android - SCREEN_ORIENTATION_USER 和 SCREEN_ORIENTATION_SENSOR 之间的区别

在开发Android应用时,我发现了两个用于设置屏幕方向的ActivityInfo属性。具有USER的属性如下:SCREEN_ORIENTATION_USERSCREEN_ORIENTATION_USER_LANDSCAPESCREEN_ORIENTATION_USER_PORTRAIT具有SENSOR的属性如下:SCREEN_ORIENTATION_SENSORSCREEN_ORIENTATION_SENSOR_LANDSCAPESCREEN_ORIENTATION_SENSOR_PORTRAITSCREEN_ORIENTATION_USER和SCREEN_ORIENTATION_S

android - 如何让Rotate3dAnimation更流畅?

在我的应用程序中,我使用Rotate3dAnimation显示谷歌地图。代码运行良好,但动画不流畅,旋转View时也可以看到一些线条。请看看我的代码并建议我如何使这个动画更流畅?高度赞赏以任何其他有效方式实现此类动画的建议。publicclassEventsActivityextendsMapActivityimplementsDialogInterface.OnDismissListener{privateEventsItemModeleventsItemModel;privateIntegereventItemId;privateIntegereventCategoryId;pri

android - 设置 targetSdkVersion ="13"导致 Activity 忽略 android :configChanges ="orientation" flag

API级别13似乎(据我所知“悄悄地”)引入了对android:configChanges属性处理方式的更改。在我的特殊情况下,当应用程序list中的“targetSdkVersion”设置为“13”时,任何配置为内部处理方向更改的Activity(例如,不应在屏幕旋转时重新启动)总是重新启动,而不管android:configChanges="orientation"属性在他们的声明中。将“targetSdkVersion”简单切换为“12”即可恢复预期行为。我搜索了API13发行说明,但找不到任何提及此类更改的内容。有谁知道API13(可能还有更高版本的API)是否会在设计上不支持

android - 传感器 TYPE_ACCELEROMETER/TYPE_MAGNETIC_FIELD 和 TYPE_ORIENTATION 之间的不同值

有2种方法可以获取3个旋转值(方位角、俯仰角、滚转角)。一种是注册类型为TYPE_ORIENTATION的监听器。这是最简单的方法,我从每次旋转中得到正确的值范围,如文档所述:方位角:[0,359]间距:[-180,180]滚动:[-90,90]另一个是第一次看到时最精确和最复杂的。Android推荐它,所以我想使用它,但我得到了不同的值。方位角:[-180,180]。-180/180是S、0iN、90E和-90W。音高:[-90,90]。90是90,-90是-90,0是0但-180/180(屏幕朝下)是0。滚动:[-180,180]。我应该得到相同的值但有小数,对吗?我有以下代码:a

android - android :orientation ="vertical" vs android:orientation ="horizontal"之间的区别

我想知道这两者之间有什么区别?一个比另一个的好处?等等…… 最佳答案 “水平”允许布局中的元素彼此并排放置,而“垂直”则将它们堆叠在一起。两者都没有真正的好处-使用最适合您的设计的那个。officialdocumentation说:“布局应该是一列还是一行?对行使用“水平”,对列使用“垂直”。 关于android-android:orientation="vertical"vsandroid:orientation="horizontal"之间的区别,我们在StackOverflow上找

iphone - 为什么 UITabBarController 返回 "..should support at least one orientation"消息?

我将UITabBarController子类化以覆盖shouldAutorotateToInterfaceOrientation:这样我就可以在某些情况下支持横向模式。当我运行它时,当覆盖的方法返回NO时,选项卡栏Controller会给我以下消息TheviewcontrollerreturnedNOfrom-shouldAutorotateToInterfaceOrientation:forallinterfaceorientations.Itshouldsupportatleastoneorientation.除了返回YES之外,关于如何获取消息的任何建议一直在shouldAuto

iphone - window.orientation 在 UIWebView 中不起作用

我正在使用3.2和4.0iO,我正在尝试在UIWebView中运行html文件。html文件包含以下几行:varpwint=function(text){varoutput=document.getElementById('output');output.innerHTML=output.innerHTML+text+'\n';};varreorient=function(e){pwint('WindowOrientation:'+window.orientation);};window.onorientationchange=reorient问题是window.orientation

iphone - 方向错误 :'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

我正在尝试使用此代码在View上强制定向。-(BOOL)shouldAutorotate{returnYES;}-(NSUInteger)supportedInterfaceOrientations{returnUIInterfaceOrientationMaskLandscape;}-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{returnUIInterfaceOrientationLandscapeLeft;}模拟器中的View在横向加载时发生了什么,当我将其转换为纵向时,应用程序崩溃并且