2017-08-01 5 views
-1

私のアプリでは、画像、見出し、日付のみを表示するrecyclerviewのニュースページを実装しました。ユーザーが特定のニュースをクリックすると、そのニュースの詳細ページにリダイレクトされます。今、このページでは、ニュースの主な写真であるニュースの表紙画像が表示されます。このニュースの下に、そのニュースの説明が表示されます。そして、その下で彼は4,5枚の画像のような、そのニュースに関連する多くの画像を見ることができます。ここでは、画像リストがすべてのニュースについて固定されているわけではないことを言及したいと思います。 4または5または6である可能性があります。ページにはスクロールビューの動作が必要です。 CollapsingToolbaseのレイアウトについて読んだことがあります。しかし。この場合、スクロールバーでテキストまたはイメージを追加できます。しかし、それを行う最も効率的な方法は何でしょうか。私はこの詳細ページの適切なレイアウトを作成していました。以下の説明と多くの画像andoidでカバー画像を表示

+0

このhttps://github.com/ongakuer/CircleIndicatorを試してみてhttps://github.com/JakeWharton/ViewPagerIndicatorとhttp://www.androprogrammer.com/2015/06/view-pager- with-circular-indicator.htmlとこれもhttps://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/ –

+0

@NileshRathod私はしませんここに任意のビューページャーを実装したい。このページはスクロールする必要があります。表示の動作 –

+0

は簡潔に説明します –

答えて

0

あなたの画像に別のRecyclerViewを使用することもできます。この方法で、イメージのリストをアダプターに渡し、イメージの量を動的にします。

EDIT

は、これと同様のレイアウトください:

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

    <ImageView 
     android:id="@+id/imageView2" 
     android:layout_width="match_parent" 
     android:layout_height="150dp" 
     android:src="@color/dark_blue" /> 

    <TextView 
     android:text="Your description: Lorem ipsum dolor sit amet..." 
     android:layout_width="match_parent" 
     android:layout_height="200dp" /> 

    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 

をそして他の画像とあなたのRecyclerViewを取り込みます。

+0

画像のリサイクラービューは1つのオプションです。しかし、Cover Imageの下のfixrdの説明のために私は何ができますか?私はここで全体を整理する方法を意味します –

+0

私の答えを編集しました。これがあなたの必要とするものなら教えてください。 –

+0

ありがとう。はい、私はこのタイプのレイアウトが必要です。私はそこにScrollViewを追加しました。 –

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

      <ImageView 
       android:id="@+id/top_seller" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@color/colorAccent" 
       android:contentDescription="@string/app_name" 
       android:adjustViewBounds="true" 
       android:src="@drawable/image1" 
       android:scaleType="fitXY" 
       /> 
     <android.support.v4.widget.NestedScrollView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="none"> 
      <TextView 
       android:id="@+id/textView2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/large_text" /> 
     </android.support.v4.widget.NestedScrollView> 


     <android.support.v7.widget.RecyclerView 
       android:id="@+id/image_list" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" /> 
     </LinearLayout> 
</ScrollView>