Hello dear programmers. I try to do so in order to add prepared layout.xml files with markup to add to the main window. Like fragments. Not onCreate , but let's say in some kind of actionlistener(View view){} Inside some LinearLayout

Is it possible to do? If you can, how? Thank you in advance.

    1 answer 1

    Something like this:

     //берем контейнер внутрь которого собираемся впихнуть LinearLayout container = (LinearLayout)findViewById(R.id.container); LayoutInflater inflater =(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); //наш лейаут View child = inflater.inflate(R.layout.child, null); //добавляем в контейнер container.addView(child); 
    • Pasiba uncle Barmaley !!!! - EmErIx_007