如何修复AAPT:错误:"???dp' 与属性layout_marginEnd (attr) 维度不兼容



安卓工作室安装后,我想创建一个测试应用程序,所以我只在默认的helloworld应用程序中添加了一个按钮并运行它,但我遇到了这个错误。(在stackoverflow搜索类似的问题和解决方案后,我问了一个问题……(

AAPT: error: '???dp' is incompatible with attribute layout_marginEnd (attr) dimension. 

以下是安卓工作室自动生成的代码:

<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello world!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="۳۲dp"
android:layout_marginEnd="۱۸۰dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
</androidx.constraintlayout.widget.ConstraintLayout>

用非英语书写的数字可能会通过更改进行更正

android:layout_marginTop="32dp"
android:layout_marginEnd="180dp"

android:layout_marginTop="۳۲dp"&amp;android:layout_marginEnd="۱۸۰dp""10dp"一样使用英文编号

更改此项:android:layout_marginTop="۳۲dp"android:layout_marginEnd="۱۸۰dp"收件人:android:layout_marginTop="5dp";android:layout_marginEnd="5dp";

(按钮标签内(

最新更新