2017-10-02 7 views
0

私はビューページで動作します。私は3つあり、すべてのページでこれを取得しています。 この出力を得るためにエラーが見つかりませんerror[![][1]] 2Androidのビューページのレイアウトに関する問題

上部に白いストライプがありません。私はそれを修正するために何かを見つけることはありません。ここに私のコードは次のとおりです。

とstory.java:

import android.content.Context; 
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.Button; 



public class Story1Fragment extends Fragment { 

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 

     View rootView = inflater.inflate(R.layout.fragment_story1, container, false); 

     Button _play = (Button) rootView.findViewById(R.id.btn_play); 

     _play.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 

      } 
     }); 
     return rootView; 
    } 
} 

メインレイアウト:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 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="com.jeravare.hypralyne.MainActivity"> 


    <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/pager" 
     android:layout_width="368dp" 
     android:layout_height="495dp" 
     android:layout_marginTop="8dp" 
     app:layout_constraintTop_toTopOf="parent" 
     tools:layout_editor_absoluteX="8dp"></android.support.v4.view.ViewPager> 


</android.support.constraint.ConstraintLayout> 
+0

問題は、アクティビティのレイアウトであるが、フラグメントは、彼が無実である、間違って何もしませんでした。 –

答えて

0

問題は、フラグメントレイアウトではありません。

android:layout_width="368dp" 
android:layout_height="495dp" 
android:layout_marginTop="8dp" 

これに:あなたはこの変更することができ

android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_marginTop="8dp" // you can remove this if you don't need a space at the top 
+0

は、メイン – nicBit

+0

を追加しました。 – nicBit

関連する問題