Source code can be found at : https://github.com/AliRezaeiii/Contacts
I have following layout in my Activity :
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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="wrap_content"
android:layout_height="wrap_content"
tools:context=".ui.MainActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_behavior=".behavior.QuickHideBottomBarBehavior">
<com.sample.android.contact.widget.ListenableTabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:background="@drawable/rectangle_shape"
app:tabIndicatorHeight="2dp"
app:tabSelectedTextColor="@color/color1" />
<ImageView
android:id="@+id/triangle"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_above="@+id/tab_layout"
android:layout_marginBottom="-1dp"
android:src="@drawable/triangle_shape"
tools:ignore="ContentDescription" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
As you can see triangle ImageView includes : android:layout_marginBottom="-1dp"
and it works fine on my Google pixel2 420dpi device.
But in Galaxy nexus xhdpi It looks like this :[
]2
When I change marginBottom to -1.5dp it looks as expected.
What approach you suggest to resolve this issue?