I have a question about viewpager.
Is that possible to mix portrait and landscape orientation in one viewpager?
To be specific, some of the pages are in portrait orientation while other pages are in landscape orientation.
Thanks.
you can override the method getWidth(int) from the adapter to change the width of each page and with that, changing their proportions.
Related
My application's orientation is fixed to portrait due to some functionalities that always in action.
I need to add to the main activity a fragment with a landscape orientation, so it's layout should be portrait, but rotated 90 degrees.
My problem is that a TextView won't fit the screen because it's width is longer than the screen's width. Also, rotating it (or anything else) won't work properly because the rotation is being done after it's being located.
Is there any library that can handle such thing? Or what can I do to handle that problem?
Hello guys i have problem with my Listview . I have different layout for portrait and landscape item listview (layout and layout-land) like here :
Item listview Layout for Portrait
Item listview Layout for Landscape
this is simulation rotate from portrait to landscape
result on portrait / not yet rotated
result after rotated landscape
Which I want after rotated
so how to solve it ?
This link helped me to solve a similar problem. I hope that it helps you too.
Android: alternate layout xml for landscape mode
Can we fix the orientation for one imageview in framelayout, and orientation of other children of frame layout be controlled by the sensor?
I want to fix the orientation of image in background and on top of that need to show some reults in textviews. If I fix the activity in landscape then I can't draw the text portrait wise.
You can use separate xml for portrait and landscape mode.
1.you have to create separate folders layout-land, layout-port
2.save the xml in it.
3.Be sure with both have the same name.
You can refer here
Orientation can only be applied on activities,we cannot set the orientation of views.
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. :)
I have a ViewFlipper with several ScrollViews inside. Depending on the child ScrollView I need to force the ViewFlipper's orientation to portrait or landscape. How can I achieve this ? Thanks.
Take a look at http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/reference/android/widget/HorizontalScrollView.html
In the first document, note that you can provide different layout files for landscape versus portrait modes. For example, for landscape mode, you could have a layout file in res/layout-land.
If you want more help putting the pieces together, just ask.
Edit: It looks like I misread the original question. Take a look at these two posts:
Force an Android activity to always use landscape mode
Android force Horizontal (landscape) layout