/ / Childs substituir tamanho de peso de layout android pai - Android, android-layout, android-layout-weight

Childs substituir tamanho de peso de layout android pai - android, android-layout, android-layout-weight

Eu quero ter sucesso no layout a seguir

*<LinearLayout>
*<ListView with standard height = 50% of screen>
*<TableLayout with standard height = 20% of screen>
*<Fragment with standard height = 30% of screen>
*</LinearLayout>

O problema aqui é que o Listview terá itens infinitos de 0 algumas vezes. Quando não há nenhum item na lista, Tablelayout e fragmento sobem para a tela.

Como posso dizer ao Listview para não calcular o tamanho com base nas exibições de listitem?

Eu já tentei o seguinte, tendo a pré-visualização de estúdio do Android apresentar uma interface de usuário correta, mas ao executar no dispositivo o FrameLayout tem altura = 0 porque a lista está vazia.

*<LinearLayout>
*  <FrameLayout and LinearLayout with weight>
*    <ListView>
*  </FrameLayout and /LinearLayout>

*  <TableLayout with standard with weight>
*<Fragment with standard with weight>

Eu realmente apreciaria qualquer ajuda.

Respostas:

0 para resposta № 1

a única solução que consigo pensar é assim

*<LinearLayout>
*<ListView with standard height = 50% of screen>
*<View with standard height = 50% of screen visibily=gone>
*<TableLayout with standard height = 20% of screen>
*<Fragment with standard height = 30% of screen>
*</LinearLayout>

então, quando você descobrir que o ListView tem 0 itens, altere a visibilidade da visão.