Java 我的拖鞋&;drop在Android Studio中不起作用

Java 我的拖鞋&;drop在Android Studio中不起作用,java,android,android-layout,mobile,Java,Android,Android Layout,Mobile,正如您在上图中看到的,当您拖动某个对象时,有对齐选项“to RightOf=button”、“below=button”,但当我拖动某个对象时,不会显示类似的选项。谁能帮我修一下吗 设置文本视图的位置,然后尝试通过拖动添加另一个视图 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

正如您在上图中看到的,当您拖动某个对象时,有对齐选项“to RightOf=button”、“below=button”,但当我拖动某个对象时,不会显示类似的选项。谁能帮我修一下吗


设置
文本视图的位置
,然后尝试通过拖动添加另一个视图

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/activity_main">


    <TextView
        android:id="@+id/text_witaj_uzytkowniku"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop ="true"
        android:layout_alignParentLeft="true"
        android:text="@string/witaj_uzytkowniku" />


</RelativeLayout>

我认为您应该使用。
如果您继续使用Relativelayout,则转到文件失效并重新启动您的Android studio,如果这是与缓存相关的问题,则解决它。

使用协调器布局来工作。RelativeLayout更多的是编码布局。

老实说,我更喜欢使用ConstraintLayout作为根。我相信使用拖放工具更容易

使用时,请确保(或父对象)至少垂直和水平各一次。 这在代码中的外观:

<androidx.constraintlayout.widget.ConstraintLayout
    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">

    <TextView
        android:id="@+id/textView9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:layout_marginTop="24dp"
        android:text="TextView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/textView10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:text="TextView"
        app:layout_constraintStart_toStartOf="@+id/textView9"
        app:layout_constraintTop_toBottomOf="@+id/textView9" />
</androidx.constraintlayout.widget.ConstraintLayout>


要使用布局,您只需在托盘中键入Constraint layout并拖动它(如果未安装,将进行下载)

@JakirHossain那么如何更改它?@JakirHossain您是指content_main.xml吗?仍然没有:(默认情况下,用户界面帮助窗口不在android studio中出现,仅当根据我的知识进行任何插件/插拔安装时,创建一个新项目并尝试或更新使用ConstraintLayout,如果不更新ConstraintLayout版本,则最新版本为1.1.3
<androidx.constraintlayout.widget.ConstraintLayout
    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">

    <TextView
        android:id="@+id/textView9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:layout_marginTop="24dp"
        android:text="TextView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/textView10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:text="TextView"
        app:layout_constraintStart_toStartOf="@+id/textView9"
        app:layout_constraintTop_toBottomOf="@+id/textView9" />
</androidx.constraintlayout.widget.ConstraintLayout>