2017-09-07 8 views
0

내가 보여주기 위해 어떤 카드를 가지고 있지만,이 화면 전체에 피팅되지 않습니다카드는 <code>CardView</code> 내 화면에

이 내 XML입니다 화면에 완전히 표시되지 :

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

> 




<android.support.v7.widget.CardView 

    android:id="@+id/card_view" 
    android:layout_width="match_parent" 
    android:layout_height="90dp" 
    android:layout_marginTop="10dp" 
    card_view:cardCornerRadius="2dp" 
    card_view:cardElevation="4dp" 


    > 


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/cardview_bg" 
     android:orientation="horizontal" 


     > 

     <View 
      android:layout_width="10dp" 
      android:layout_height="90dp" 
      android:background="@color/colorGray"> 

     </View> 


     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="80dp" 
      android:layout_marginTop="12dp" 
      > 

      <TextView 
       android:id="@+id/name" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 

       android:textColor="@color/colorGray" 
       android:textSize="14dp" 
       android:textStyle="bold" /> 

      <LinearLayout 
       android:id="@+id/linear" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/name" 
       android:layout_marginTop="3dp" 
       android:orientation="horizontal"> 

       <TextView 
        android:id="@+id/university" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="20dp" 
        android:textColor="@color/colorGray" 


        android:textSize="12dp" 
        android:textStyle="bold" /> 

       <ImageView 
        android:layout_width="14dp" 
        android:layout_height="14dp" 
        android:layout_marginLeft="7dp" 
        android:src="@drawable/placeholder" /> 

       <TextView 
        android:id="@+id/city" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="2dp" 
        android:textColor="@color/colorGray" 


        android:textSize="12dp" 
        android:textStyle="bold" /> 
      </LinearLayout> 




     </RelativeLayout> 


    </LinearLayout> 




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


</LinearLayout> 

final image

내 home.xml은 recyclerView를 구현했습니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:id="@+id/content_home" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.raheel.bank.Home" 
tools:showIn="@layout/activity_home"> 

    <android.support.v7.widget.RecyclerView 
    android:id="@+id/recycle_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 

    android:scrollbars="vertical" 
    android:layout_alignParentStart="true" /> 
    </RelativeLayout> 

더 명확하고 사용하기 쉽도록 화면에 카드를 완전히 표시하고 싶습니다. 지금 바로 활동에 적합하지 않기 때문에.

답변

0

카드 뷰에 app:cardPreventCornerOverlap="false" 속성을 추가하십시오. 희망이 작동합니다.

+0

recyclerView에서 패딩을 제거한 후 코드 라인 –

0

xml이 ListView 또는 RecyclerView의 항목으로 사용 된 것 같습니다. RecyclerView에 여백이 없어야합니다.

+0

이 잘 작동하지 않습니다. 그러나 내가 그렇게 생각한만큼 좋지는 않습니다. –

+0

'RecyclerView' xml – Adarsh

+0

로 질문을 업데이트하십시오 !! 나는 또한 recyclerView에 대한 XML을 추가했습니다 –