BVtp
BVtp

Reputation: 2480

PagerTabStrip cuts the fragment

I'm trying to implement a viewPager , where I navigate between two fragments on the same activity. And I also added PagerTabStrip. I made just a little sample but for some reason it cuts the fragment.. It also doesn't display buttons defined in the layout

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MenuFragment extends Fragment
{

    @Override
    public void onCreate( Bundle savedInstanceState )
    {
        super.onCreate(savedInstanceState); 
    }

    @Override 
    public View onCreateView( LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState ) 
    {
        View v = inflater.inflate(R.layout.fragment_menu, parent, false);

        TextView textShow = (TextView)v.findViewById(R.id.textViewMenu);
        textShow.setText( "works" );
        return v;
    }
}

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

    <TextView 
        android:id="@+id/textViewMenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        />
    <Button 
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        />

    <LinearLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="center|bottom">

       <Button
        android:id="@+id/true_button"
       android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

       <Button
        android:id="@+id/false_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    </LinearLayout>
</LinearLayout>

Upvotes: 1

Views: 125

Answers (0)

Related Questions