[Tex/LaTex] How to move Beamer headline below frametitle

beamerformattingheader-footernavigationpositioning

I am creating my own Beamer theme based on the Berlin theme and what I want to do is to move the navigation bar below the frametitle, instead of the default position (i.e., top of page, above everything).

For example, the following picture and code uses the Berlin theme, which creates a navigation bar in the headline on top of the frame. How can I move the frametitle to the top of frame and move the navigation bar below the frametitle?

enter image description here

\documentclass{beamer}
\usetheme{Berlin}
\begin{document}
\section{First Sec}
\begin{frame}{First Frame Title}First Section\end{frame}
\section{Second Sec}
\begin{frame}{Second Frame Title}Second Section\end{frame}
\end{document}

Best Answer

After searching a while and could not find an answer, I doubt if there is any straightforward command to do this. However, I figured out a workaround to do this, for those who might be interested.

First, you need to know which outer theme (.sty file) your beamer theme uses. In this case, the Berlin theme ( beamerthemeBerlin.sty ) uses the mini frame outer theme ( beamerouterthememiniframes.sty ).

I then went into this outer theme and changed the definition of the headline and added a definition for the frametitle. See my code below:

% Head Line
\defbeamertemplate*{headline}{miniframes theme}
{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=10.25ex,dp=4.5ex,left]{frametitle}
    \hspace{6pt}
    \usebeamerfont{frametitle}
    \insertframetitle
    \vskip2pt
  \end{beamercolorbox}%
  \vspace{-10pt}
}

% Frame Title
\defbeamertemplate*{frametitle}{miniframes theme}
{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.4ex,dp=0.7ex,center]{section in head/foot}
    \usebeamerfont{headline}
    \insertnavigation{0.85\paperwidth}
  \end{beamercolorbox}%
 % no subsection title for simplicity
}

And the results are shown below:

enter image description here enter image description here