---
title: "Android开发便签9:在android资源文件中定义字符串数组"
author: "andyzhchy"
date: "2011-06-16T10:35:09Z"
tags: ["Android", "Java", "XML"]
categories: ["移动开发"]
slug: "android-9-android"
draft: false
lastmod: "2011-06-16T10:35:09Z"
id: 1093996
url: "https://andyzhchy.iteye.com/blog/1093996"
---

小便签一个，如何在android的资源文件中定义字符串数组及在代码中调用方法 在array.xml中设置字符串数组资源： \[code="xml"] test1 test2 test3 \[/code] 在代码中可以如下调用： \[code="java"] String\[] test = getResources().getStringArray(R.array.test); \[/code]