0

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

在这个视频中,这个人似乎只是将一个按钮拖到了他的应用程序上,不需要做任何重新调整就可以让它在他想要的位置。他正在使用 VS 2017,而我正在使用 VS 2019,现在的问题是当我尝试按照他的示例进行操作时,我的按钮超出了文本栏,而我还没有找到让按钮进入文本栏下方的方法就像在视频中一样。请问有谁知道我该如何解决这个问题?谢谢

4

1 回答 1

0

你可以看看Xamarin.Android Layouts,有一个LinearLayout你可以试试。如果您在下面设置android:orientation="vertical"并拖动,那么它将显示为您想要的。ButtonTextView

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> 

用户界面的效果:

在此处输入图像描述

Aout使用 Xamarin.Android 设计器,您可以查看此文档。

于 2020-02-27T02:00:28.327 回答