android - TabLayout not expanding over whole screen width -


image of problem

i want fill space left , right of tablayout aswell, fills whole screen. cant work. layout.xml.

<?xml version="1.0" encoding="utf-8"?> <relativelayout 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"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context="cytek2806northman.tabtestproject.mainactivity">      <android.support.design.widget.appbarlayout         android:layout_height = "wrap_content"         android:layout_width = "match_parent"         >          <android.support.design.widget.tablayout             android:layout_height = "wrap_content"             android:layout_width = "match_parent"             android:id="@+id/tablayout"             app:tabmode="scrollable"             app:tabgravity="fill"             >         </android.support.design.widget.tablayout>       </android.support.design.widget.appbarlayout>          <android.support.v4.view.viewpager             android:layout_width="match_parent"             android:layout_height="match_parent"             android:id="@+id/viewpager">         </android.support.v4.view.viewpager>   </relativelayout> 

since can't se values of margins in relative layout, must theese attributes causes empty spaces. remove them , should work, since else looks right.

<?xml version="1.0" encoding="utf-8"?> <relativelayout 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" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context="cytek2806northman.tabtestproject.mainactivity">