-1

In my android studio project for a app for clash royale decks i have made a button with a link (https://link.clashroyale.com/deck/de?deck=26000018;26000003;28000000;26000005;26000019;26000000;26000001;26000002&;id=2YP8QVQUL) Android Studio marks the "&" in red

this is my code in xml

<Button
    android:id="@+id/button4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="100dp"
    android:layout_marginEnd="100dp"
    android:layout_marginBottom="40dp"
    android:background="@android:color/holo_orange_light"
    android:text="@string/about_link"
    android:autoLink="all"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

this is my code in strings

<string name="about_link"><a href='https://link.clashroyale.com/deck/de?deck=26000018;26000003;28000000;26000005;26000019;26000000;26000001;26000002&;id=2YP8QVQUL'>Import Deck</a></string>
  • answer available in this question https://stackoverflow.com/questions/3053062/how-to-write-character-in-android-strings-xml – Zaid Zakir Jun 27 '21 at 12:04

1 Answers1

0

You should encode & in strings.xml file

Replace & with &amp;
Tefa
  • 328
  • 1
  • 4
  • 15