2017-11-18 96 views

回答

0

來獲取資源id出來的資源名稱,下面使用此代碼。我在我的項目中測試過。像魅力一樣工作。

String packageName = getPackageName(); 
String tempCurrent = "square" + String.valueOf(currentParams.x+1) + String.valueOf(currentPrams.y+1); 
int resId = getResources().getIdentifier("square", "id", packageName); 
currentImageView = (ImageView) findViewById(resId);