2017-04-17 1 views
0

제품을 표시하기 위해 recyclerview gridview를 사용하고 있습니다. 내가있는 LinearLayout 내부에 카드보기를 사용하고android recyclerview gridview 항목이 제대로 표시되지 않습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
xmlns:app="http://schemas.android.com/tools" 
android:orientation="vertical"> 

<android.support.v7.widget.CardView 
    android:id="@+id/card_view" 
    android:layout_width="@dimen/cover_height" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    card_view:cardUseCompatPadding="true" 
    android:elevation="7dp"> 

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


     <com.makeramen.roundedimageview.RoundedImageView 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/thumbnail" 
      android:src="@drawable/placeholder_image" 
      android:scaleType="fitXY" 
      app:riv_oval="false" 
      app:riv_corner_radius_top_left="6dp" 
      app:riv_corner_radius_top_right="6dp" 
      android:layout_height="@dimen/cover_height" 
      android:layout_width="match_parent" /> 

     <pseudozero.smalam.com.finwallet.utils.TextViewPlus 
      android:id="@+id/tvProductTitle" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/thumbnail" 
      android:textColor="@color/colorBlack" 
      android:textSize="15dp" 
      android:text="Wrist Watch" 
      android:padding="5dp" 
      app:customFont="fonts/Proxima_Nova_Bold.otf"/> 


     <pseudozero.smalam.com.finwallet.utils.TextViewPlus 
      android:id="@+id/tvProductVendor" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/tvProductTitle" 
      android:textSize="13dp" 
      android:paddingLeft="5dp" 
      android:paddingBottom="5dp" 
      android:text="Rolex" 
      app:customFont="fonts/Proxima_Nova_Reguler.otf"/> 

     <pseudozero.smalam.com.finwallet.utils.TextViewPlus 
      android:id="@+id/tvPriceTag" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="500 BDT" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:textColor="@color/colorWhite" 
      android:textSize="13dp" 
      android:padding="10dp" 
      android:background="@drawable/price_tag_back_n" 
      app:customFont="fonts/Proxima_Nova_Bold.otf"/> 

    </RelativeLayout> 

</android.support.v7.widget.CardView> 

그러나이 this is the view

내 XML 뷰 코드 등의 전시입니다. 그러나 나는 이것을 얻고있다. 서버로부터 모든 데이터를로드하고있다. 두 번째 항목 만 올라갑니다. 모든 항목이 장식되기를 바랍니다.

+0

당신은 내가 cardview의 높이를 수정해야 카드보기 –

+0

에서 이미지의 높이를 수정해야 :( –

+0

설정 수정 높이의 높이가 고정되어 있지만 작동이 같은 :( –

답변

0
  1. 사용 RoundedImageViewCardViewRoundedImageView
  2. 사용 속성 android:scaleType="centerCrop" 대신 android:scaleType="fitXY"의 높이를 고정.

희망이 도움이 될 것입니다 ~

+0

그것을하지 보여주는 레이아웃 –

0

RelativeLayout의 높이가

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

에 그리고 당신의 코드에서

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

를 wrap_content해야 당신은 닫지 부모의 LinearLayout을한다.

관련 문제