Currently, when you connect an external monitor to an Android phone that supports mirroring, the phone makes the assumption that the external monitor is set up in a landscape orientation. Thus, when the phone is held vertically (in this case, the Galaxy S III) in a portrait orientation, the video output on the display is portrait, but centered with black bars on either side. Of course, when the phone is held horizontally, the output fills the external display.
What I'm looking for is a way to force the Galaxy S III to mirror its screen such that when it is held in a portrait orientation, the output will fill the external display. It would have to work across Android - I'm not talking about a specific app in particular, it needs to work consistently across all apps.
The external display would be mounted vertically, so it's essential that the output from the Galaxy S III while in portrait orientation completely fills and has the correct orientation on the external display.
Can anyone give me any advice on where to begin? I've already looked through the source code for the S III and haven't been able to find any clues (I'm not experienced in writing my own drivers on Android). This would be for the US variants (specifically Verizon, though the video hardware - Adreno 225 GPU and SiI9234 MHL controller chip - is the same across all US variants). Perhaps someone who is more experienced in that field could shed some light on this.
Unfortunately that is not possible. you would have to develop your app in landscape mode and then rotate all your views/content to make it seem it is in vertical portrait mode. One option for that would be animations. ie:
rotateAnimation.xml:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="50%"
android:duration="0"
android:fillAfter="true" />
Your Code:
TextView text = (TextView)findViewById(R.id.txtview);
text.setText("rotated text here");
RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation);
t.setAnimation(rotate);
Also you can have a look at this post:
Vertical (rotated) label in Android
Related
I'm working on a web application that uses Bootstrap 5.0 for the styling and I have a strange anomaly going on.
I have a collection of buttons (<a>...</a>) that are lined up in a horizontal pattern as shown in the attached image. As you can see, the desktop view looks great, but for some reason, looking at this on my mobile phone, the buttons are all crunched together indicating that the gap part of the class="d-grid gap-2 d-sm-flex" is being ignored by my mobile phone.
In my dev environment, I use the browser's dev tools (F12) to view it using Galaxy S5 in landscape mode which is the closest thing to my Galaxy A51 5G phone. My immediate suspicion is that perhaps it has to do with the fact that the gap-# in bootstrap translates to rem rather than pixels. I'm looking into that now. Until then please let me know if you have a more concrete answer.
Thanks a bunch.
Okay, I found an acceptable workaround, but I'm still interested if you know what the deal is with the gap-# not working on the mobile device. Here's what I did for now...
I removed all of the class="gap-#" and placed the following in the class of each button inside the foreach loop that places the buttons:
<button class="mb-2 mb-sm-0 me-0 me-sm-2" type="button" ... </button>.
This allows me to set the bottom margin of each button to have some space with the right side having no space while in mobile (portrait mode), but then have the bottom margins set to 0 and the right (end) margins set to have some space while in landscape mode and every size larger than the smallest size.
It seems a bit "hacky", but it works.
Please answer if you know a better way to get the gap-# to work in landscape mode of a small mobile device.
Thanks.
In the Android Studio design preview, my layout fits perfectly on screen.
Even when I played it though AVD, it fits well.
But when I connect my phone with Android studio and run it, it doesn't fit in my phone screen. It seems like centerCrop is on the whole screen. all layouts have the same problem.
I'm using a Samsung s8+. Preview setting is also Samsung s8+ which Android Studio provides.
At first, I thought that this problem is caused by 18.5:9 ratio of my phone. But in that case, the screen should be cut only at bottom and top. But it seems like centerCrop is enlarging based on the center?
The screenshot on the left is what I see on the preview and on the right is what I see on my physical phone:
Two Solutions:
Go for Linear layout if you don't bother layout hierarchy and coding style, as it fits for the most number of screens.
The design which you saw in the emulator will not be same in Actual mobile device in all cases. So try to debug your app in actual mobile device and design accordingly.
Make sure that your custom emulator has the same settings ( Height, Width, RAM ) as your phone.
I am working on LG optimus 3D mobile platform and it seems to me I can experience the depth of three dimensions in landscape mode but the effect is completely lost while the phone is in portrait. does anyone have any suggeston how to make that work on portrait mode as well?
If you are using the p920, i'm afraid you (actually we cuz I have one too) are out of luck. 3d is landscape only.
Reference links :
http://3dvision-blog.com/5798-testing-the-3d-capabilities-of-the-lg-optimus-3d-p920-smartphone/
http://blog.gsmarena.com/htc-evo-3d-vs-lg-optimus-3d-taking-the-fight-to-another-dimension/
First of all, sorry for my english. I'm programming an Augmented Reality Browser for Android following the steps in Raghav Sood's book. Its title is Pro Android Augmented Reality. The thing is that when i launch the example of chapter 9 (named Pro Android AR 9 and located in https://github.com/RaghavSood/ProAndroidAugmentedReality) in my devices, it works fine or not depending on the kind of device.
In my Sony Ericsson Xperia Arc with Android 4.0.4 the browser implemented by Raghav works really fine. When i test the augmented-reality browser in Asus Eee Pad Transformer or in Samsung Galaxy Tab, both of them with Android 4.0.3, the readings from the sensors seem to be wrong. Holding the tablets in landscape mode in front of me, if i focus over one spot (wikipedia, twitter or local markers) and turn over myself to the right, the spots goes down. If i turn to the left, the spots goes up. If i want the spots to move to the left, i have to tilt the devices making their screens look to the ground. In the same order, if i turn the devices making the screens look up to the air, the spots will move to the right.
Seems like the program is confusing sensor readings. Anyone knows how to solve the problem??? Thanks in advance.
i made it. I don't know if it is a good solution but seems to work fine on tablets.
Changing the axis to:
SensorManager.remapCoordinateSystem(temp, SensorManager.AXIS_X, SensorManager.AXIS_Y, rotation)
in SensorActivity seems to fix the axis malfunction. Other problem was that the text asociated with each POI appeared turned in tablets using landscape mode. To avoid this, i used a conditional rotation modification in set method of PaintablePosition class:
if(drawObj.toString().toLowerCase().contains("paintableboxedtext")) rotation=rotation+270;
I'm developing an Android game that uses the orientation sensor to get the rotation of the device (to roll a ball). I have two devices that I test apps on, one is a Samsung Infuse (phone) and the other is an Asus Eee Pad Transformer TF101 (tablet).
The app runs in landscape on both devices. The problem is that on the Eee Pad, the orientation is measured with the device sideways (landscape mode) while the Infuse measures in upright (portrait) no matter what I do. This makes is so the ball moves left when I tilt my Infuse left, but when I tilt the Eee Pad left, the ball moves up or down.
I can switch the orientation angles, so they move the ball the other way, but it only works for one or the other at a time. Any ideas how I could fix this?
Yes, I am using the deprecated TYPE_ORIENTATION, and not the getOrientation() method. I tried setting it up, but I never got it working correctly and it always spat out really weird values, so I stuck to the deprecated one. Would switching over fix this at all? If so, can someone link me to resources to implement this?
Google's docs make it clear that the sensor coordinate system is relative to the default orientation of the device. That description mentions the getRotation() and remapCoordinateSystem() calls you can use to adjust appropriately.