XML 코드를 동적으로 편집 할 수 없습니다. 그러나 XML 코드에서 ImageView
의 크기를 동적으로 변경할 수있는 일부 속성을 설정할 수 있습니다.
먼저 android:layout_width
및 android:layout_height
을 wrap_content
으로 설정해야합니다. 둘째, XML의 src
속성 또는 setImageResource()
메서드로 ImageView를 이미지로 설정하십시오. ImageView
. 당신은
Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), PICK_IMAGE_MULTIPLE);
사용 onActivityResult()
에 결과를 처리 할 이미지를 선택하는 의도 선택기를 사용할 수 있습니다
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.myRecycler);
MyAdapter adapter = new MyAdapter(photosList);
RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getApplicationContext(), 2);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setAdapter(adapter);
같은 RecyclerView에 선택한 이미지를 추가에서 당신을 중지 무슨