2015-06-04 44 views
-5
LayoutInflater inflater = getLayoutInflater(); 
view1 = inflater.inflate(R.layout.item_drawer_im`enter code here`age,null); 
RoundedImageView imageView1 = (RoundedImageView) view1.findViewById(R.id.photo); 
Picasso.with(com.muzoly.vkmusic.AudioList.this) 
     .load(vkApiUsers.get(0).photo_200) 
     .into(imageView1); 
TextView textView = (TextView) view1.findViewById(R.id.text); 
textView.setText(vkApiUsers.get(0).first_name + " " + vkApiUsers.get(0).last_name); 
mDrawerLayout.setDrawerListener(createDrawerToggle()); 
String arr[] = {"Популярное", "Мои аудиозаписи", "Рекомендации", "Загрузки","Настройки"}; 
mDrawerList.setAdapter(null); 
mDrawerList.addHeaderView(view1); 

這是我的AudioList.java文件。我想從string.xml文件中獲取數組文本。String arr [] = {「1」,「2」};來自string.xml的數組

什麼是java代碼?

+0

'字符串[] ARR =新的String [] { 「ABC」, 「DEF」, 「等」};' – Kon

回答

-1

解決!謝謝!

Java代碼:

String arr[] = getResources().getStringArray(R.array.menuu); 

的strings.xml

<string name="popular">Pop</string> 
    <string name="recommend">Рекоммендации</string> 
    <string name="my_audios">Мои аудиозаписи</string> 
    <string name="settings">Настройки</string> 
    <string name="downloads">Загрузки</string> 

    <string-array name="menuu"> 
     <item>@string/popular</item> 
     <item>@string/recommend</item> 
     <item>@string/my_audios</item> 
     <item>@string/settings</item> 
     <item>@string/downloads</item> 
    </string-array> 
相關問題