Unwanted space created in the layout

baldraider

I'm developing a UI for my application and it's working fine on all devices of the size ratio 18:9 except in Xiaomi 18:9 devices.It creates unwanted space between Tab layout and status bar like this : home screen

I don't add any top margin or padding for Tab layout.

My xml code :

<?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardCornerRadius="0dp"
    android:id="@+id/tabCardView">

    <android.support.design.widget.TabLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/tabHeight"
        android:id="@+id/tabLayout"
        app:tabMode="fixed"
        android:background="?attr/tabBackgroundColor"/>

</android.support.v7.widget.CardView>

<android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/viewPager"
    android:background="?attr/homeBackgroundColor"
    android:layout_below="@+id/tabCardView"/>
</RelativeLayout>

I have no any idea why this happening.

Grisgram

What happens if you put this meta-data in the tag of your manifest? It could well be, that this device is using 18.5:9 and not plain 18:9

<application ....  >
    <meta-data
        android:name="android.max_aspect"
        android:value="2.1"/>

</application>

More information here: https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related