I read this and I tried to reorder the views but the toolbar is still not visible on Android 19.
I don't know why the toolbar is not visible on android 19.
This is the repo.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<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:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<ImageButton
android:id="@+id/bt_picture"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="@drawable/ic_photo_white_24dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"/>
<ImageButton
android:id="@+id/bt_pdf"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="@drawable/ic_picture_as_pdf_white_24dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"/>
<ImageButton
android:id="@+id/bt_clear"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="@drawable/ic_delete_white_36dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<com.example.ricardochampa.signatureapp.SignatureView
android:id="@+id/signature_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:id="@+id/line_view"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:layout_marginStart="70dp"
android:background="@color/grey"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/line_view"
android:layout_centerHorizontal="true"
android:textColor="@color/grey"
android:layout_marginTop="10dp"
android:text="@string/sign_here" />
</RelativeLayout>
Try the layout below.
<RelativeLayout
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<ImageButton
android:id="@+id/bt_picture"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"
android:background="@drawable/ic_photo_white_24dp" />
<ImageButton
android:id="@+id/bt_pdf"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"
android:background="@drawable/ic_picture_as_pdf_white_24dp" />
<ImageButton
android:id="@+id/bt_clear"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="end"
android:layout_marginEnd="10dp"
android:background="@drawable/ic_delete_white_36dp" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<com.example.ricardochampa.signatureapp.SignatureView
android:id="@+id/signature_view"
android:layout_below="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:id="@+id/line_view"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:layout_marginStart="70dp"
android:background="@color/grey"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/line_view"
android:layout_centerHorizontal="true"
android:textColor="@color/grey"
android:layout_marginTop="10dp"
android:text="@string/sign_here" />
</RelativeLayout>
And in activity add (optionally)
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar()!=null){
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
The reason was ToolBar
is getting hide by SignatureView
. Although i donot have any idea right now how it is getting visible above 19.