After install of android studio I wanted to create a test app so I added only one button to the default hello world app and run it but I got this error. (after search stackoverflow for similar problem and solution I ask a question......)
AAPT: error: '???dp' is incompatible with attribute layout_marginEnd (attr) dimension.
here is auto generated code by android studio:
<?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>
CodePudding user response:
You have used arabic numerals for android:layout_marginTop="۳۲dp"
&& android:layout_marginEnd="۱۸۰dp"
use english numbering instead like "10dp"
CodePudding user response:
Change this: android:layout_marginTop="۳۲dp" android:layout_marginEnd="۱۸۰dp" to: android:layout_marginTop="5dp" android:layout_marginEnd="5dp"
(inside the Button tag)
CodePudding user response:
Numbers written in a non-English language will probably be corrected by change
android:layout_marginTop="32dp"
android:layout_marginEnd="180dp"