首页 > 解决方案 > 如何解决此问题 > 属性 app:constraintBottom_toBottomOf 未找到

问题描述

Android新手在这里。

我正在构建和 AR 应用程序,现在我计划添加一个用户界面。我正在尝试向 中添加约束布局app:layout_constraintBottom_toBottomOf="parent",但是我收到未找到此约束的错误

这些是我的代码和错误消息:

代码和错误 更多的错误

我在我的activity_ux.xml 文件中添加的所有以“app”开头的代码行例如app:layout_constraintBottom_toTopOf似乎都不起作用,我只是在这里向您展示了一个示例,其中一个只是为了使调试更容易我认为。

我尝试在线搜索,其中一个解决方案是我应该在我的 SDK 工具中安装“ConstraintLayout for Android”和“Solver for ConstraintLayout”,但我已经安装了这个。

    <FrameLayout 
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          tools:context="com.google.ar.sceneform.Overlei.Overlei">

    <fragment android:name="com.google.ar.sceneform.ux.ArFragment"
          android:id="@+id/ux_fragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />

    <LinearLayout
          android:id="@+id/gallery_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          app:layout_constraintBottom_toBottomOf="parent"
  >

   </LinearLayout>

   </FrameLayout>

我希望这能正常工作,我不知道如果内置函数(例如这个)不起作用,我可以从哪里开始寻找。

标签: javaandroidandroid-layout

解决方案


谢谢你们的建议。我已经设法通过添加这一行来处理错误

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

进入我的build.gradle(module.app)dependencies

再次感谢您所做的一切


推荐阅读