0

I Have a simple spinner and would disable an element. Could I disable elements from the xml files? Or i need to code something in JAVA?

<Spinner
    android:id="@+id/stato"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:entries="@array/feedbacktypelist"
    android:layout_below="@+id/textview">
</Spinner>

arrays.xml

<resources>
    <string-array name="feedbacktypelist">
        <item>@string/stato1</item>
        <item>@string/stato2</item>
        <item>@string/stato3</item>
        <item>@string/stato4</item>
        <item>@string/stato5</item>
    </string-array>
</resources>

strings.xml

<resources>

<string name="stato1">ITALIA</string>
<string name="stato2">SPAGNA</string>
<string name="stato3">GERMANIA</string>
<string name="stato4">REPUBBLICA CECA</string>
<string name="stato5">INGHILTERRA</string>

</resources>
Prova Allwinner
  • 117
  • 1
  • 1
  • 6

1 Answers1

1

You can do two things, comment out the line in the resource array via highlighting the row and doing ctrl+/

or

You can remove the android:entries="@array/feedbacktypelist" line and add the list yourself but skipping the entry you don't want (most common me thinks) see how here How to create Spinner-list using CustomAdapter in android

em_
  • 2,134
  • 2
  • 24
  • 39