[Tex/LaTex] Height filling minipages in Beamer

beamerheightminipage

I am trying to accurately center things in my Beamer frames with animations. For that purpose, I would like to use minipages with fixed height, which should be automatically inferred so that I do not have to guess for each frame what is the correct height to specify. I tried to do the following, but it does not work:

\documentclass{beamer}

\usetheme{Ilmenau}
\useoutertheme{smoothbars}
\usecolortheme{seahorse}

\begin{document}

\begin{frame}
    \begin{minipage}{1\linewidth}
        List
        \begin{itemize}
            \item<1-> Point 1
            \item<2-> Point 2
        \end{itemize}
    \end{minipage}
    \only<1>{
        \begin{minipage}[c][\fill]{1\textwidth}
            \centering
            centered text
        \end{minipage}}
    \only<2>{
        \begin{minipage}[c][\fill]{1\textwidth}
            \centering
            \color{green}{\rule{4cm}{3cm}}
        \end{minipage}}
\end{frame}

\end{document}

Why is this not working and is there another way to do this?

Best Answer

When you specify the size of a box the natural size of a length is used (which is 0pt in the case of \fill).

I think you want something like

\documentclass{beamer}

\usetheme{Ilmenau}
\useoutertheme{smoothbars}
\usecolortheme{seahorse}

\begin{document}

\begin{frame}
    \begin{minipage}{1\linewidth}
        List
        \begin{itemize}
            \item<1-> Point 1
            \item<2-> Point 2
        \end{itemize}
    \end{minipage}
    \only<1>{\vspace*{\fill}\par
        \begin{minipage}[c][.7\textheight][c]{1\textwidth}
            \centering
            centered text
        \end{minipage}
        \par\vspace*{\fill}}
    \only<2>{\vspace*{\fill}\par
        \begin{minipage}[c][.7\textheight][c]{1\textwidth}
            \centering
            \color{green}{\rule{4cm}{3cm}}
        \end{minipage}
        \par\vspace*{\fill}}
\end{frame}

\end{document}