Can I give an ID to an item in String-array?

No, you can't give ID to individual array items.
Here you may see syntax.
To be short this is example from mentioned docs:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="planets_array">
        <item>Mercury</item>
        <item>Venus</item>
        <item>Earth</item>
        <item>Mars</item>
    </string-array>
</resources>

And this is how you get access to strings:

Resources res = getResources();
String[] planets = res.getStringArray(R.array.planets_array);

Updated
To achieve your goal you may store separated name and some additional info:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="names">
        <item>Martin:martin93</item>
        <item>Maria:mary1985</item>
  </string-array>
</resources>

And then just use String.split() method to get two (or more) parts.
Note that it may be necessary to choose more complicated separator than ':'.
And to use it directly in the Spinner you should implement your own adapter.


If it is not needed to translate IDs you could map the translatable array entries to IDs in code. Advantage of that would be that you can avoid accidential order mismatches between IDs and values. For that use string resources for every array entry:

<string-array name="my_array" translatable="false">
    <item>@string/text_1</item>
    <item>@string/test_2</item>
    ...
</string-array>

<string name="text_1">My first entry</string>
<string name="text_2">My second entry</string>
...

In code retrieve the string resources and put them as key + ID into a hash map:

val myArrayIdMap: HashMap<String, String> = java.util.HashMap()
myArrayIdMap[getString(R.string.text_1)] = "id-1"
myArrayIdMap[getString(R.string.text_2)] = "id-2"
...

To get the ID of a specific string use the map, for example if the string array is used in a spinner, the select listener could retrieve the ID:

...
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
    val selectedEntry: String = parent?.getItemAtPosition(position).toString()
    val id: String = myArrayIdMap.get(selectedEntry)
}

Typically you would have

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="planets_array">
        <item>Mercury</item>
        <item>Venus</item>
        <item>Earth</item>
        <item>Mars</item>
    </string-array>

    <string-array name="planets_array_values" translatable="false">
        <item>merc</item>
        <item>ven</item>
        <item>eart</item>
        <item>mars</item>
    </string-array>
</resources>

Then populate the spinner with planets_array, and

public void onItemSelected(AdapterView<?> parent, View view, 
        int pos, long id) {
    String value = getResources().getStringArray(R.array.planets_array_values)[pos];
}