다른 xml에 있는 프레임 레이아웃을 가져와서 프레임 레이아웃에 출력시키려고 합니다.
동적으로 addview를 하면 에러가 떠서 removeview를 해줘도 에러가 뜨네요 도와주세요ㅜㅜ
xml파일:
<LinearLayout>
<FrameLayout>
<Text/image>
</FrameLayout>
<FrameLayout>
<Text/image>
</FrameLayout>
</LinearLayout>
java 파일:
FrameLayout imageTemplate; FrameLayout template1; imageTemplate = findViewById(R.id.imageTemplate); LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.activity_main, null); template1 = view.findViewById(R.id.template1); imageTemplate.addView(template1);