Xamarin 当设备旋转时,布局方向=垂直,无法工作
我将以下布局设置为方向=垂直。但当我将模拟器旋转到横向时,它会在横向中显示布局 我希望布局方向垂直,即使设备旋转到横向 如何解决这个问题?谢谢你的帮助 <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 Your 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意味着子元素垂直插入布局。因此,当您添加更多视图时,它们将堆叠在彼此下方 垂直: 水平: 这是我使用的布局。尝试自行更改方向,并查看效果:Xamarin 当设备旋转时,布局方向=垂直,无法工作,xamarin,xamarin.android,Xamarin,Xamarin.android,我将以下布局设置为方向=垂直。但当我将模拟器旋转到横向时,它会在横向中显示布局 我希望布局方向垂直,即使设备旋转到横向 如何解决这个问题?谢谢你的帮助 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_heigh
<?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>
所以它看起来像:
[Activity(Label = "Herp Derp", ScreenOrientation = ScreenOrientation.Portrait)]
public class HerpDerpActivity : Activity
{
// more stuff here
}
对它正在工作!我必须导入Android.content.PM用于屏幕定向。
[Activity(Label = "Herp Derp", ScreenOrientation = ScreenOrientation.Portrait)]
public class HerpDerpActivity : Activity
{
// more stuff here
}