Visual Studio 2017与Visual Studio 2019与Android应用程序开发的区别

问题描述 投票:-1回答:1

我正在尝试按照此处的本教程制作一个简单的android应用程序:https://youtu.be/5CgQUbnf1Qk

在此视频中,这个人似乎只是将一个按钮拖到了他的应用上,并且不需要进行任何重新排列就可以将其放置在他想要的位置。他正在使用VS 2017,而我正在使用VS 2019,现在的问题是当我尝试按照他的示例进行操作时,我的按钮移到了文本栏上,而我还没有找到一种方法来使按钮移到文本栏下就像在视频中一样有谁知道我该如何解决这个问题?谢谢

android user-interface xamarin.android visual-studio-2019 visual-studio-2017-build-tools
1个回答
0
投票

您可以看一下[[Xamarin.Android Layouts,有一个LinearLayout您可以尝试一下。如果设置android:orientation="vertical"并将Button拖动到TextView下方,则它将显示为您想要的。

Xml代码将如下所示:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:text="Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAlignment="center" android:fontFamily="monospace" android:minWidth="25px" android:minHeight="25px" android:id="@+id/textView1" /> <Button android:text="Button" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/button1" /> </LinearLayout>

用户界面的效果:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.