screen-orientation

setCurrentItem of nested viewpager

浪尽此生 提交于 2019-12-23 23:27:49
问题 I have a ViewPager nested in a fragment, and when the device changes orientation I'd like to save and restore which page the ViewPager was on. I'm currently doing this: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mViewPager = (ViewPager) inflater.inflate(R.layout.activity_albumpicker, container, false); // Create the adapter that will return a fragment for each of the three // primary sections of the activity.

radiogroup behavior on orientation change

自作多情 提交于 2019-12-23 13:26:14
问题 I am hoping that someone can help me understand what's going on with respect to an Android radiogroup and the onCheckedChanged callbacks when the orientation changes. I have a radio group with three radio buttons. The second button is defined as the default by setting the checked attribute to true. My xml for the radio group is as follows: <RadioGroup android:id="@+id/rgReportRange" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android

Android - detect reverse landscape orientation

懵懂的女人 提交于 2019-12-23 12:50:16
问题 I need to detect reverse landscape orientation in order to prevent user to start capturing vertical videos. I've implemented 2 layouts in layout-land and layout-port folders with different set of controls. The problem is that Android doesn't allow me to create a separate layout specifically for reverse landscape. I need this because video is recorded upside down in this case, albeit UI is displayed correctly. If I rotate device from 0 to 180 orientation Android doesn't even call onCreate() of

orientation lock in android programmatically

人盡茶涼 提交于 2019-12-23 09:33:06
问题 I have the following code. Java public void lockScreenOrientation() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } public void unlockScreenOrientation() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } I am calling these functions from javascript. Control is entering these methods. However the orientation is not locked. I have tried following to lock the orientation setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);

Android orientation change causes things to disappear

守給你的承諾、 提交于 2019-12-23 06:07:03
问题 Below is my layout for the row template in a SimpleCursorAdapter. The ImageView with id next_arrow disappears permanently on orientation change (going back to original orientation doesn't make it re-appear). If I replace @drawable/arrow with @drawable/icon (copy of the standard sym_def_app_icon) it works fine. All the drawables in question are simple references to PNG files . I thought it might be somehow related to the icons being of different dimensions, but I resized @drawable/icon to be

Rotate only between landscapeLeft and landscapeRight

守給你的承諾、 提交于 2019-12-23 05:07:33
问题 I have vidoe playing in landscape mode. And the view only rotate between landscapeLeft and landscapeRight when the device orientation changes. That's to say there is no portrait mode when playing the movie. What's more apart from the movie view, other views are portraint mode, so the app config is portrait. How can I make the movie view only rotate in the landscape mode. Here is a part of my code. appdelegate, internal var shouldRotate = false func application(_ application: UIApplication,

Restore Android GridView after screen orientation change (without reloading it)

試著忘記壹切 提交于 2019-12-23 04:55:24
问题 I'm new to Android (this is my first application) and I made a GridView in an Activity which I'd like it to be responsive according to screen position (portrait / landscape). Of course I made some custom layout values of GridView rows width for portrait as well as for landscape, and it works perfect. Except that, on every screen orientation change, the GridView is reloading again. And that's not good for user experience. I only like the GridView (and definitely its rows) to adjust to new

How do you prevent the android screen from being turned sideways?

删除回忆录丶 提交于 2019-12-23 01:41:49
问题 Whenever I turn the device sideways, everything in my app also turns and becomes distorted. How do I lock it into vertical? 回答1: In your AndroidManifest.xml set the orientation on your Activity to portrait like this. <activity android:name=".YourActivity" android:label="@string/app_name" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 回答2:

UIImagePickerController shows black bar when zooming – Is this a bug in iOS?

倖福魔咒の 提交于 2019-12-22 12:40:10
问题 Edit : It has been suggested this post is a duplicate, which is not the case as the black bars are not initially present an an affine transformation does not remedy the problem. I run this on an iPad Air 2 and target iOS 8. I have a UIImagePickerController whose showsCameraControls property is set to NO . When starting the app in landscape and then zooming in, this is what happens (all images are non-cropped): A black bar appears and can be gotten rid of by changing device orientation to

Viewflipper Receiver not registered error while orientation change in 2.1 and 2.2

为君一笑 提交于 2019-12-22 08:13:54
问题 I am using viewflipper for fling gesture recognition everything works fine for 2.0 and prior but in 2.2 and 2.1 it throws exception as "java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper" below is full debug trace. java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper$1@452f8398 09-19 11:33:06.825: ERROR/AndroidRuntime(393): at android.app.ActivityThread$PackageInfo.forgetReceiverDispatcher(ActivityThread.java:793) 09-19