0

I have a layout file that I use to display some information at the bottom of the screen. This has been working as expected for the past year. Recently however I realised that the text was no longer being displayed. This is my xml:

<RelativeLayout 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/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="nl.l1nda.contactinfo.ContactInfoActivity">


    <TextView
        android:id="@+id/appVersionText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_alignParentBottom="true"
        android:padding="@dimen/activity_margin"
        android:text="Some text here"
        android:background="@color/colorAccent"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/black_overlay" />
</RelativeLayout>

This is shown in the Design view as follows: enter image description here

But when running the app the text is just not shown:

enter image description here

Note however that the view is there, as setting its size to 90dp shows the following:

enter image description here

Has the behaviour of relative layouts changed somehow?

EDIT: As requested, styles.xml:

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:textColor">@drawable/text</item>
    </style>

    <style name="ThemeDialog" parent="Theme.AppCompat.Light.Dialog">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowFullscreen">false</item>
    </style>

    <style name="AppTheme.Launcher" parent="AppTheme.NoActionBar">
        <item name="android:background">@color/black_overlay_dark</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="android:textColor">@color/colorPrimaryDark</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="colorControlNormal">@color/white</item>
    </style>

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <style name="FullscreenTheme" parent="AppTheme">
        <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowBackground">@null</item>
        <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
        <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    </style>

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
        <item name="android:background">@color/black_overlay</item>
    </style>

</resources>
spacitron
  • 2,095
  • 7
  • 30
  • 39

3 Answers3

0

I had the same problem when I upgraded to android Nougat, I recently solved it using below code snippet.

Please put fitsSytemWindow=true in manifest for your activity.

halfer
  • 19,824
  • 17
  • 99
  • 186
Er. Kaushik Kajavadara
  • 1,657
  • 2
  • 16
  • 37
0

Just add this in style.xml v-21

<item name="android:fitsSystemWindows">true</item>
<item name="android:windowTranslucentNavigation">true</item><-this can be ignore
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
Rajesh
  • 2,618
  • 19
  • 25
0

None of the answers here seemed to help do I did some further research and I managed to solve it by adding the following in my activity:

 AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
 params.setScrollFlags(0);
spacitron
  • 2,095
  • 7
  • 30
  • 39