xamarin - Layout is Orientation =vertical when device rotate it wont work -


i have following layout set orientation = vertical. when rotate emulator landscape, show layout in landscape.

i want layout in orientation vertical device rotate landscape.

how solve problem? appreciate help.

 <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:id="@+id/mylinearlayout"     android:minwidth="25px"     android:minheight="25px">     <textview         android:id="@+id/mylabel"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="put name here :" />     <edittext         android:id="@+id/myeditbox"         android:inputtype="textmultiline"         android:textcolor="@android:color/background_dark"         android:layout_width="match_parent"         android:layout_height="wrap_content" />     <button         android:id="@+id/mybutton"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:text="hey! click me" /> </linearlayout>    

android:orientation="vertical" means children inserted layout vertically. when add more views stack underneath each other.

vertical:

vertical

horizontal:

horizontal

this layout used. try change orientation on own , see effect:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="horizontal"     android:layout_width="fill_parent"     android:layout_height="fill_parent">     <view         android:background="#aabbdd"         android:layout_width="50dp"         android:layout_height="50dp" />     <view         android:background="#341233"         android:layout_width="50dp"         android:layout_height="50dp" />     <view         android:background="#123456"         android:layout_width="50dp"         android:layout_height="50dp" />     <view         android:background="#654321"         android:layout_width="50dp"         android:layout_height="50dp" />     <view         android:background="#550000"         android:layout_width="50dp"         android:layout_height="50dp" /> </linearlayout> 

if want lock rotation in activity, need add following property activityattribute:

screenorientation = screenorientation.portrait 

so like:

[activity(label = "herp derp", screenorientation = screenorientation.portrait)] public class herpderpactivity : activity {     // more stuff here } 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -