Skip to content

Menu: Header & Footer

三木思 edited this page Nov 6, 2018 · 2 revisions

Picture

You can see the picture above, the border above of the picture is the header view, and the border below of the picture is the footer view.

You can refer to 'Header & Footer' in the demo.

Header

There are tow methods to attach a header view to the menu, you can use it by calling in TimoMenu or TimoMenu.Builder:

Method Description
setHeaderView(View headerView) Specify a view directly
setHeaderLayoutRes(int headerLayoutRes) Specify a layout resource id directly

Footer

There are tow methods to attach a footer view to the menu, you can use it by calling in TimoMenu or TimoMenu.Builder:

Method Description
setFooterView(View headerView) Specify a view directly
setFooterLayoutRes(int headerLayoutRes) Specify a layout resource id directly

About the LayoutParams of 'setHeaderView' & 'setFooterView'

If you directly specify a view without layoutparams, it may cause the header view and footer view width and height properties to be invalid.

When you need to pass a header view or a footer view, you'd better specify a viewgroup when you create it like the following:

 View footer = getLayoutInflater().inflate(R.layout.layout_footer, mTimoMenu.getMenuView(), false);

Clone this wiki locally