错误突出显示文本"数组"红色。我该如何解决?
public class Signup extends Activity {
AutoCompleteTextView y;
String[] z;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.signup);
y = (AutoCompleteTextView) findViewById(R.id.cntry);
z = getResources().getStringArray(R.array.country);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, z);
答案 0 :(得分:0)
您在res / values文件夹中的arrays.xml文件中使用TypedArray,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="country">
<item>@drawable/pakistan</item>
<item>@drawable/india</item>
<item>@drawable/USA</item>
</string-array>
</resources>