0

私はプロフィールを見ることを望みます(下記参照)。 enter image description hereビューページャにコンテンツを追加する方法。私は内容を見ることができません

現在、プロフィール写真と2つのタブ(日記と友だち)のビューがあります。

これは2つのタブを含む自分のアクティビティレイアウトです。

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/base_background" 
     android:id="@+id/app_bar"> 

     <include layout="@layout/dog_profile" /> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/dog_header" 
      android:background="@color/base_background" 
      app:tabGravity="fill" 
      app:tabMode="fixed" /> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/primary" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

</RelativeLayout> 

この日記フラグメントが、私は日記断片内のものを参照してください傾けます。おそらく左上にあります。

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view" 
     android:layout_below="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:scrollbars="vertical" 
     android:background="@color/accent" 
     android:layout_alignParentBottom="true"/> 

    <TextView 
     android:id="@+id/tv_no_memories" 
     style="@style/NoItemsStyle" 
     android:text="@string/no_memories" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     style="@style/FabStyle"/> 
</RelativeLayout> 

<?xml version="1.0" encoding="utf-8"?> 

は、私は私がフラグメント内のコンテンツを見ることができたことを変更すべきか見当がつかない。私の活動で

は私が活動のXMLで縦向きでリニアレイアウトに相対的なレイアウトを変更することで解決のアドバイス

+0

あなたが取得している場合、いくつかのJavaコードまたはエラーを追加してください。 – androidnoobdev

+0

私はJavaコードを追加しました。私は何の誤りもない、私はちょうど内容を見ることができません。私は日記の断片を間違って設定していると思う。 – user3637775

答えて

0

ため、この

ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); 
    adapter.addFragment(new DogDiaryFragment(), tab1); 
    adapter.addFragment(new DogFriendsFragment(), tab2); 
    viewPager.setAdapter(adapter); 

tabLayout.setupWithViewPager(viewPager); 

おかげのようなビューのページャを設定しています。

関連する問題