How to get RelativeLayout working with merge and include?

前端 未结 8 1984
余生分开走
余生分开走 2020-12-02 04:37

I have been trying for a few days now to make my layouts more efficient by converting from using several levels of nested LinearLayouts to one RelativeLay

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 05:30

    For positioning to work on RelativeLayout you need to set the layout_* parameters in the include file, not in the main layout file. That way

    main_layout.xml

    
       ....
    
    
    
        .....
    
    
    
    

    content_layout.xml

    
    
    
        ....
    
    
    

    This is obviously not what us developers want, but it's the only solution I've found to avoid duplicating xml

提交回复
热议问题