Alejandro Lora
Alejandro Lora

Reputation: 7802

Line Between Toolbar and Tabs - Android 5

I have a line between my toolbar and my tabs and I don't know why, because if my app is executed in another smartphone with Android 4.* the line is disappeared...

I am working on toolbar with tabs, I am using SlidingTabLayout and SlidingTabStrip from Google...

I don't know if there is some important information to say but if you need to know something more, let me know...

Thankss

EDIT: here a photo about this...

enter image description here

This is the activity's layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="es.alejandrolora.devhub.activitys.VideosCommentsActivity">

<include
    android:id="@+id/toolbar"
    layout="@layout/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<es.alejandrolora.devhub.Util.SlidingTabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:elevation="2dp" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" />

Upvotes: 2

Views: 1467

Answers (2)

Pushpendra
Pushpendra

Reputation: 2819

Give same elevation value to both Toolbar and SlidingTabLayout. Because if there is some elevation in Toolbar it will again show that line.

In Lollipop, Material design introduces elevation for UI elements and that help users to understand the relative importance of each element and focus their attention to the task at hand for more detail read this:https://developer.android.com/training/material/shadows-clipping.html

In Short: Elevation of Toolbar and SlidingTabLayout should be same.

Upvotes: 5

Alejandro Lora
Alejandro Lora

Reputation: 7802

I tried my app in Android 5.0.2 on Motorola G2 and the line wasn't visible but in my version (5.1) on Nexus 5, it was, but I got fix the problem...

I just had to erase this attribute:

android:elevation="2dp"

Thanks

Upvotes: 6

Related Questions