0

As you guys can see in the image, my fragment container exceeds the smartphone screen, but its height is set as fill_parent, and everything it's included in (the custom view and drawer layout) are fill_parent too. Shouldn't my fragment be filling its parent?

enter image description here enter image description here

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="fill_parent">

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.a.s.MainActivity">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            >
            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_scrollFlags="scroll|enterAlways|snap"
                android:background="#6495ED"
                />
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#6495ED"
                />
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:id="@+id/fragment_container"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:layout_below="@+id/appbar">

        </android.support.v4.view.ViewPager>
    </android.support.design.widget.CoordinatorLayout>
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_nav"
        app:menu="@menu/activity_nav_drawer" />

</android.support.v4.widget.DrawerLayout>
Gatonito
  • 1,662
  • 5
  • 26
  • 55
  • could you post the entire layout file? – Lxu Jul 28 '16 at 12:55
  • http://stackoverflow.com/questions/33489430/android-studio-project-bottom-of-ui-is-cut-off/33489533#33489533 – Lucas Ferraz Jul 28 '16 at 12:59
  • @KhalidTaha where? I tried in the fragment container and it didn't work – Gatonito Jul 29 '16 at 02:38
  • @LucasPaolillo sorry, I didn't understand. I'm using coordinator layout but without any listview, just a fragment container. How can I change the implementation? – Gatonito Jul 29 '16 at 02:40
  • use match_parent instead of fill_parent in the height of the viewPager – Khalid Taha Jul 30 '16 at 03:19
  • @KhalidTaha I used but no effect. Since the parent is a Custom View with height = total screen height, but it has a toolbar and tabs, giving match_parent to the View Pager will make it occupy the entire screen + the size of action bar & tabs. fill_parent should work but I don't know why it doesn t – Gatonito Jul 31 '16 at 00:30

0 Answers0