2016-04-30 2 views
0

J'ai un TabLayout dans mon application où chaque onglet a son propre fragment. Mais je ne peux pas voir le contenu complet de mon fragment parce que le TabLayout chevauche le bas du fragment. Comment puis-je résoudre le problème?TabLayout chevauche ViewPager Fragment

activity_main.xml

<RelativeLayout 
    android:id="@+id/main_layout" 
    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="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".activitys.MainActivity"> 

     <de.fhbielefeld.cardash.cardash.NonSwipeableViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"/> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tab_layout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/colorPrimary" 
      app:tabMode="fixed" 
      app:tabGravity="fill" 
      android:layout_alignParentBottom="true"/> 



</RelativeLayout> 

fragment.xml

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

    <com.skobbler.ngx.map.SKMapViewHolder 
     android:id="@+id/map_surface_holder" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_media_pause" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true"/> 

</RelativeLayout> 
+0

Cela pourrait aider http://www.gadgetsaint.com/android/create-viewpager-tabs-android/#.WPuppVN97BI – ASP

Répondre

0

essayer

<?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" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.union.experiment2.MainActivity" 
tools:showIn="@layout/activity_main"> 

<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 
<de.fhbielefeld.cardash.cardash.NonSwipeableViewPager 
    android:id="@+id/viewpager" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"/> 

<android.support.design.widget.TabLayout 
    android:id="@+id/tab_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary" 
    app:tabMode="fixed" 
    app:tabGravity="fill" 
    android:layout_alignParentBottom="true"/> 
<include 
    layout="@layout/fragment"/> 

Espérons que cela fonctionnera faire la mise en page d'onglet dans la présentation linéaire avec l'orientation verticle et juste juste ude les choses que vous voulez afficher dans votre mise en page