How can I define a fragment's layout from XML?

后端 未结 2 1187
萌比男神i
萌比男神i 2021-01-01 15:37

I\'m trying to define a fragment\'s layout in XML in the same way that I defined the layout of my view.

Is this possible? I tried several things, but none of them se

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-01 16:31

    Simply add into your tag as property:

    tools:layout="@layout/your_layout_xml"
    

    And in your main.xml (or tag container) into your parent container (in this case ListView):

    xmlns:tools="http://schemas.android.com/tools"
    

提交回复
热议问题