没有android studio能够体验到如此丰富的经验,而是从专业人士那里获得了源代码。我想知道如何重新整理String和int同步数组。因此,存在这张图片(imgapache_11),其中显示了来自其他阵列的信息(Apache,Attackopter)。图像及其附带的信息(Apache,Attack Helicopter)的顺序现在是静态的{1、2、3,}。但是我希望随机化可绘制文件夹中所有图像的刷洗顺序。
请帮助!
代码下方:
公共类Activity4radar扩展了Activity {
ViewPager viewPager;
PagerAdapter adapter;
String[] rank;
String[] country;
String[] population;
Integer[] flag;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity4radar);
// Get the view from viewpager_main.xml
setContentView(R.layout.activity_activity4radar);
// Generate sample data
rank = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"};
country = new String[] { "Apache", "Bar Lock", "F-15E","F-16","F-16","F-16","", "F-16",
"F-16","Apache","Apache","Apache","Apache" };
population = new String[] { "Attack Helicopter", "Radar",
"Fighter Bomber", "Fighter", "Fighter", "Fighter", "",
"Fighter", "Fighter", "Attack Helicopter", "Attack Helicopter",
"Attack Helicopter","Attack Helicopter"};
flag = new Integer[] {R.drawable.imgapache_11, R.drawable.imgbarlock_1,
R.drawable.imgf15e_7, R.drawable.imgf16_1, R.drawable.imgf16_2, R.drawable.imgf16_3,
R.drawable.imgf16_4, R.drawable.imgf16_4, R.drawable.imgf16_6, R.drawable.imgapache_12,
R.drawable.imgapache_13, R.drawable.imgapache_14, R.drawable.imgapache_15};
// Locate the ViewPager in viewpager_main.xml
viewPager = (ViewPager) findViewById(R.id.pager);
// Pass results to ViewPagerAdapter Class
adapter = new ViewPagerAdapterRadar(Activity4radar.this, rank, country, population, flag);
// Binds the Adapter to the ViewPager
viewPager.setAdapter(adapter);
}
}