I have a pretty strange issue. So, I have a base tab layout which helps navigation between different activities and fragment. However, some of the layouts (esp fragment layouts) seem to be cut off exposing activities in the background.
Any idea why it could be doing this? Here's the code for the fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/settingsSeparatorColor"
android:clickable="true"
android:focusable="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white">
<ImageButton
android:id="@+id/nav_back_btn"
style="@style/Button.ImageButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:background="@color/transparent"
android:contentDescription="@string/back"
android:tint="@color/black"
app:srcCompat="@drawable/ic_close" />
<TextView
android:id="@+id/profile_edit_button"
style="@style/Body1RegRightBlack"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/profile_edit"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/profile_pic_container"
layout="@layout/item_profile_pic" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="12dp">
<TextView
android:id="@+id/fullName"
style="@style/Headline3CenterBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:background="@android:color/transparent"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Text.Chronicle"
tools:text="Angela Heely" />
<TextView
android:id="@+id/companyName"
style="@style/Body2RegCenterGrey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/fullName"
android:background="@android:color/transparent"
android:paddingTop="12dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular"
android:textSize="16sp"
tools:text="Cardinal Dev Agency" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="32dp"
android:gravity="center_vertical"
android:weightSum="2">
<TextView
style="@style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="@string/home_location"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular" />
<TextView
android:id="@+id/home_location"
style="@style/Body1RegRightGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular"
tools:text="My Home location" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/settingsSeparatorColor"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:visibility="gone"
android:weightSum="2">
<TextView
style="@style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="@string/push_notifications"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/push_notification_switch"
style="@style/Color1SwitchStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/settingsSeparatorColor" />
<include layout="@layout/item_settings_separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/reset_password"
style="@style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="@string/reset_password"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular" />
<ImageView
android:id="@+id/reset_password_chevron"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:background="@drawable/ic_baseline_chevron_right_24px"
android:contentDescription="@null"
android:gravity="end"
android:backgroundTint="@color/brownish_grey" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/settingsSeparatorColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:weightSum="1">
<TextView
android:id="@+id/legal_terms"
style="@style/Body1RegLeftBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:text="@string/eula"
android:textAppearance="@style/TextAppearance.Text.Roboto.Regular" />
<ImageView
android:id="@+id/legal_terms_chevron"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:background="@drawable/ic_baseline_chevron_right_24px"
android:contentDescription="@null"
android:gravity="end"
android:backgroundTint="@color/brownish_grey" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/settingsSeparatorColor" />
<include layout="@layout/item_settings_separator" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/settingsSeparatorColor"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/optionLogout"
style="@style/Body1RegCenterRed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text="@string/sign_out" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:background="@color/transparent"
android:fitsSystemWindows="true"
android:gravity="bottom|center_horizontal">
<TextView
android:id="@+id/optionVersion"
style="@style/Caption1RegCenterGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Build v. 0.0.1" />
</RelativeLayout>
</LinearLayout>
Here's the code for the tab base container layout: (Please note the actual screen content is displayed in the linearlayout titled : dynamicContent below)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/white"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/white"
android:id="@+id/bottomNavBar"
android:orientation="horizontal"
android:fitsSystemWindows="true"
android:foregroundGravity="bottom"
android:translationZ="60dp"
android:layout_alignParentBottom="true"
>
<RadioGroup
android:id="@+id/radioGroup1"
android:gravity="center"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:text="Matching"
android:layout_weight="1"
android:button="@null"
android:padding="2dp"
android:checked="false"
android:textSize="12sp"
android:drawableTop="@drawable/ic_baseline_chevron_right_24px"
android:textColor="@color/black"
android:id="@+id/matching"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="@null"
android:layout_weight="1"
android:padding="2dp"
android:checked="false"
android:textSize="12sp"
android:drawableTop="@drawable/ic_baseline_chevron_right_24px"
android:textColor="@color/black"
android:id="@+id/watchList"
android:text="Watchlist"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:id="@+id/rates"
android:button="@null"
android:paddingTop="5dp"
android:paddingBottom="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:layout_weight="1"
android:checked="false"
android:textSize="12sp"
android:drawableTop="@drawable/ic_baseline_chevron_right_24px"
android:textColor="@color/black"
android:text="Rates"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="@null"
android:padding="2dp"
android:checked="false"
android:layout_weight="1"
android:textSize="12sp"
android:drawableTop="@drawable/ic_baseline_chevron_right_24px"
android:textColor="@color/black"
android:id="@+id/deals"
android:text="Deals"/>
<RadioButton
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
android:button="@null"
android:padding="2dp"
android:checked="false"
android:layout_weight="1"
android:textSize="12sp"
android:drawableTop="@drawable/ic_baseline_chevron_right_24px"
android:textColor="@color/black"
android:id="@+id/listing"
android:text="Listing"/>
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dynamicContent"
android:background="@color/white"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
I tried many options including fitsystemwindows, commenting out scrollview and other solutions suggested on stackoverflow, but not luck. Any ideas how to go about this one? Thanks!
Add: android:fillViewport="true"
in the scrollview