How to create a header-content layout in Android?

后端 未结 2 918

How do I go about creating the following layout in Android?

I want a \"header\", that is, a header that stays the same at all times. The only thing that should chang

2条回答
  •  心在旅途
    2020-12-13 22:39

    You can create a layout file for your header. At the top of the layout for each content activity, include the layout file like:

    
    

    How exactly you get the header to stay at the top of the content's layout will vary based on the rest of your layout. You could use a LinearLayout with orientation="vertical", or a relative layout with align_parentTop="true" on your include statement.

    This android documentation has a good summary of basic layout types.

提交回复
热议问题