Question

I work on an Android app and I use as view a FrameLayout. The problem is one of design. Inside of view, I have another FrameLayout, and a LinearLayout, that is positioned on the bottom view. But the problem is that when my FrameLayout is higher than parent, the last part of the FrameLayout is under the LinearLayout, and in this case I want, that my view from FrameLayout to occupay all part less the height of the LinearLayout.

Here is a screenshot: enter image description here

And here is my code:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</FrameLayout>

<LinearLayout
    android:id="@+id/bottom_menu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_gravity="bottom"
    android:background="@drawable/menu_background"
    android:paddingTop="8dp" >
    <TextView
        android:id="@+id/currentOffersMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/products"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/receiptStatusMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginTop="16dp"
        android:layout_weight="1"
        android:drawableTop="@drawable/receipt"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/photographReceiptMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/camera"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size"
        android:layout_marginTop="20dp" />

    <TextView
        android:id="@+id/userAccountMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/account"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/howItWorksMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/information"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

</LinearLayout>

Can someoane to help me?

Was it helpful?

Solution

If content_frame has to be alway above the LinearLayout, way not punnitng them in a LinearLayout or RelativeLayout parent? Something like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</FrameLayout>

<LinearLayout
    android:id="@+id/bottom_menu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_gravity="bottom"
    android:background="@drawable/menu_background"
    android:paddingTop="8dp" >
    <TextView
        android:id="@+id/currentOffersMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/products"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/receiptStatusMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginTop="16dp"
        android:layout_weight="1"
        android:drawableTop="@drawable/receipt"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/photographReceiptMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/camera"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size"
        android:layout_marginTop="20dp" />

    <TextView
        android:id="@+id/userAccountMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/account"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />

    <TextView
        android:id="@+id/howItWorksMenu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:drawableTop="@drawable/information"
        android:drawablePadding="4dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:textSize="@dimen/bottom_menu_text_size" />
    </LinearLayout>

<!-- Close the parent layout -->
</LinearLayout>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top