0
자산 폴더에서 가져온 이미지로 HorizontalScrollview를 수행하려고합니다. 외부 저장소에서 이미지를 가져 오는 예제로 작업 중이며 자산 폴더 경로를 변경해야하는 이유가 무엇인지 알지 못합니다. 자산을 읽기이미지를 가져올 경로를 변경하십시오.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myGallery = (LinearLayout)findViewById(R.id.mygallery);
String ExternalStorageDirectoryPath = Environment
.getExternalStorageDirectory()
.getAbsolutePath();
String targetPath = ExternalStorageDirectoryPath + "/test/";
Toast.makeText(getApplicationContext(), targetPath, Toast.LENGTH_LONG).show();
File targetDirector = new File(targetPath);
File[] files = targetDirector.listFiles();
for (File file : files){
myGallery.addView(insertPhoto(file.getAbsolutePath()));
}
}