how to add scrollview to screen in android? - android

I have done my application in portrait configaration but when load my application in to device its coming portraint configaration but I keep in landscape mode missing some controls. So I want to add scroll view to screen when changing the config to landscape. How I can add ScrollView to screen ?

You could define two version of your layout.
"res/layout/your_layout.xml" - this will be used in portrait mode
"res/layout-land/your_layout.xml" - android will use this when in landscape orientation
If you don't want to do to many changes in your layout you can add ScrollView to landscape version of your_layout.xml.
Regards!

Related

Show only one view in full screen in landscape mode when screen rotates

Integrated MPAndroid Line charts, when screen rotates to landscape I want to only graph view to be shown in full screen and all other things should be hidden. I have restricted orientation to "Portrait", how can I trigger when screen rotates to landscape even though it is restricted.
you can duplicate the XML layout file of your activity, and put it inside folder /res/layout-land if you don't have it create it. Then you can change the visibility to "gone" at the views you don't want to show in landscape mode.
Also don't restrict the orientation to portrait for this activity

How to change the layout if I change the orientation mode in Appcelerator

I'm building an app with appcelerator studio. In my first activity I've a box with text, label, image and button.
The layout is good if the smartphone is in portrait mode, but if try to move the smartphone in landscape mode, the layout is not good.
Now there is a mode to create two graphic?
For example:
login.js
login-portrait.xml
login-landscape.xml
so from code, if the device is in landscape mode I load this xml layout, if the user change the orientation I load the other view.
It is possible to do this?

Achieve react native app layout for landscape and portrait

I am creating the react native app and quite new about this. In this app, I am creating image slider, I want that image slider adjust it's view on both portrait and landscape automatically.
This Orientation plugin checks either the device is in landscape or in portrait view.
Shall I need to write layout/view for landscape and portrait independently?
Or is there any way that I can follow for my requirement.
React native uses flexbox for layout rendering. Using flexbox UI will be same for both landscape and portrait mode.

How can I make my android tablet app to look the same when it runs on phone in landscape mdoe

I have a android app layout for tablet. Its layout is 'landscape' based (i.e. it looks the way i want when I run on tablet (by default landscape).
But when I run the same app on a phone, android runs in portrait mode, (it squeeze my 'landscape' layout into a portrait ).
I have tried putting 'android:screenOrientation='landscape' in my activity in my Manifest file. But that does not fix it.
Basically, what I want is when I rotate the phone by 90 % (the width is > height), I want the phone layout looks the same as what i see on tablet (which is landscape by default).
How can I do that? android:screenOrientation='landscape' does not work.
Basically, I want some thing the game 'AngryBird', it always runs in landscape mode regardless it is phone or tablet and whether the phone is rotated.
I think you need to use 2 flags, not just one.
First is
android:screenOrientation='landscape'
Second is
android:configChanges="orientation"
First will tell android to run activity in landscape mode, where as second will tell android that do not change the orientation even when user rotates the phone. Basically with 2nd flag you are overriding orientation config changes.
Haven't done this myself, but instead of putting the main.xml layout in res/layout, try putting it in res/layout-land, so it will display this layout in landscape mode, and in res/layout-port, maybe a portrait alternative to main.xml?
Create folder \res\layout-land\ and place there your XML file with landscape layout. Phone choose between portrait and landscape layouts automatically.
Add this line in the onCreate method before you call setContentView:
setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );

Android - How to have Mixed Orientation Tabs? (some tabs portrait, others landscape)

I have created an app with multiple tabs, each with its own layout. I have shut down response to the accelerometer to keep the app in portrait mode (android:screenOrientation="portrait").
Two of the tabs are designed in portrait mode, and one tab is designed in landscape mode. I need to take advantage of the fact that the screen is wider than it is high in landscape to display a mini spreadsheet.
Here is my question: How do I orient one of the tabs to landscape, while leaving the other two in portrait mode?
Any suggestions?
To programmatically change orientation use setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); or setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);. In this case each tab click event could be tied to its relevant orientation
source: http://russenreaktor.wordpress.com/2010/01/03/solved-set-screen-orientation-programmatically/
I found a solution outside of the tab-set. The following link discusses multiple solutions for displaying Vertical text:
Vertical (rotated) label in Android
I went with "CustomTextView" by PocketMagic which can be found here: http://www.pocketmagic.net/?p=1625
With the ability to display vertical text, I can keep the entire tab-set locked in Portrait mode.
Thanks for the suggestions everyone.
-cc
not sure if you got an answer yet, but I've been searching for 30 mins and found a solution to a similar problem. Hope this helps.
I'm using tabhost and want 3 of 4 tabs to be able to rotate and 1 tab set to portrait mode only. Previously (before applying this fix) the 3 tabs would rotate until the fixed portrait tab was selected, then they were all stuck in portrait mode.
I had to set the other tabs to use the orientation of the USER to remedy this. i.e. added a setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); in the onResume of the other 3 tabs and it now works exactly as I had intended. 3 tabs will now rotate based on the user's orientation of the device, and 1 tab is fixed portrait. :)

Categories

Resources