My ListView (of my ViewFilipper) fills the parent and buttons on the bottom get hidden

♀尐吖头ヾ 提交于 2019-12-02 07:07:22

You need to make your parent ViewGroup (your root node in the layout file) a RelativeLayout and then specify android:layout_above="@id/THE_BUTTON_CONTAINER on the LinearLayout that holds the list.

The system will then ignore all intents of the list to make itself larger.

android:layout_above and android:layout_below are very handy methods when it comes to placing containers of which you don't know the size yet and I use them frequently. An example as follows:

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/myMenuBar"
    android:layout_below="@+id/myStatusBar" >

Regards

This might work.

Inside filelist.xml change

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center" >

To

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="1">

You can add include tag in linear layout like this -:

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />

    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

    <include
        android:layout_height="wrap_content"
        layout="@layout/filelist" />

        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />

        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />

    </LinearLayout>

This may help you.I dont know whether this is a right approach but for now may be the solution for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!