如何从strings.xml调用R.raw.sound数组?

时间:2019-03-28 02:52:52

标签: java android string.xml raw-file

我想从strings.xml调用此原始文件列表

int[] sound = {

    R.raw.sound1,
    R.raw.sound2,
    R.raw.sound3,
    R.raw.sound4,
    R.raw.sound5,
};

如何键入strings.xml并从代码中调用?

1 个答案:

答案 0 :(得分:0)

  

原始文件夹声音添加到strings.xml文件数组中

strings.xml

<string-array name="select_sounds">
     <item>@raw/sound1</item>
     <item>@raw/sound2</item>
     <item>@raw/sound3</item>
     <item>@raw/sound4</item>
     <item>@raw/sound5</item>
 </string-array>