I am working on an app which utilizes a Navigation Drawer (which I generated from Android Studio's Activity template), which uses fragments
internally. The Navigation Drawer is nested into my MainActivity
. I have also included a menu into the toolbar which has two more options; Filter & Settings (Settings generated from AS template too). I ran into issues when I tested the app between APIs 19 and 24.
My LoginActivity uses the drawableLeft
attribute along with a drawableTint
(which I'm aware only works for API23 and higher). How can I get the drawableLeft icon to display in white on older versions?
My second, more major issue, concerns the Toolbar
and its compatibility. In API 24 (simulated using Nexus 5X), the Toolbar
is well-aligned underneath the Status Bar, whereas in API 19, the Toolbar
goes underneath the Status Bar which also has a mismatched colour. Now, I am aware that the Toolbar is a new addition to Material Design hence being supported from API 23+ (I think), but what would be the correct approach in fixing this?
app_bar_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
tools:context="com.example.michael.whatsupldn.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/london_skyline_dark"
android:layout_alignParentTop="true"
android:id="@+id/imageView"
android:contentDescription="@string/london_skyline"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:fitsSystemWindows="true"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
Any help will be much appreciated!
P.S. If any code is needed to help the analysis, just ask away.
EDIT
I have also encountered the same Toolbar
problem within my FilterActivity...
UPDATE
After applying fitsSystemWindows
to AppBarLayout
and CoordinatorLayout
, this is the following result, which has not fixed my issue. It has actually made the case worse as it destabilised the output in API 24.