2016-06-06 8 views
0

Image of my ProblemTabLayout Erweiterung über nicht ganze Bildschirmbreite

Ich mag den Raum füllen links und rechts von meinem TabLayout aswell, so dass es den ganzen Bildschirm ausfüllt. Aber ich kann es einfach nicht zur Arbeit bringen. Das ist meine 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> 
+1

Bitte posten Sie Ihre Lösung als Antwort –

Antwort

0

Da kann ich nicht an mich, was die Werte Ihrer Margen im relativen Layout ist, dann muss es im dieses Fall entweder Attribute sein, die die leeren Räume verursacht. Entferne sie und es sollte funktionieren, da alles andere richtig aussieht.

<?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"> 
0

Lösung wurde entfernt

android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin"