gpt4 book ai didi

Android 约束布局显示属性 'android:layout_constraintWidth_percent' 未找到

转载 作者:行者123 更新时间:2023-12-03 18:28:50 26 4
gpt4 key购买 nike

我为此错误进行了很多搜索,但最终看到每个人都建议卸载 android studio 并使用所有 sdk 工作重新安装它,这对我来说是不可行的。我们如何以体面的方式消除此错误,如果有人已经给出了正确的答案,请引用我的答案。

最佳答案

请使用应用 而不是 安卓 .

app:layout_constraintWidth_percent="0.5"    

另外,添加一个约束属性,如下所示:
    app:layout_constraintStart_toStartOf="parent"  

或者
app:layout_constraintTop_toTopOf="parent"  

your_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">

<Button
android:id="@+id/btn_temp"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintWidth_percent="0.5"
android:text="Hello World!"
app:layout_constraintTop_toTopOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

关于Android 约束布局显示属性 'android:layout_constraintWidth_percent' 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53431904/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com