Tobias Baumeister
Tobias Baumeister

Reputation: 2147

Android FrameLayout not filling screen

I'm currently creating my layout for an activity with xml and the content (FrameLayout) should fill the whole screen. Unfortunately, it doesn't. Only if I change the margin to following, it works:
Left: -17dp
Right: -19dp
Top: -16dp
Bottom: -18dp

But that's not the intention. It seems like that the screen has a basic padding.
Are there any ways to fix this?

Screen

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/registration_bg"
android:fillViewport="true"
android:padding="0dp"
tools:context=".MagnetScreen" >

<LinearLayout
    android:id="@+id/main_interface"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="18dp"
    android:layout_marginLeft="17dp"
    android:layout_marginRight="19dp"
    android:layout_marginTop="16dp"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/registration_headline"
        style="@style/registration"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/registration_headline"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="@dimen/extra_large"
        android:textStyle="bold" />



</LinearLayout>

Upvotes: 1

Views: 4725

Answers (1)

thiagolr
thiagolr

Reputation: 7027

The FrameLayout is already filling the whole screen, you are filling it with that blue background (@drawable/registration_bg).

The selection shown on the screenshot is the LinearLayout which you specified the following margins:

android:layout_marginBottom="18dp"
android:layout_marginLeft="17dp"
android:layout_marginRight="19dp"
android:layout_marginTop="16dp"

Upvotes: 1

Related Questions