2017-09-07 3 views
0

Sur mon écran j'ai des cartes à montrer, mais ils ne sont pas d'ajustement pour tout l'écrancartes ne s'affichent pas entièrement sur l'écran

Ceci est mon xml pour CardView:

<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

Voici mon home.xml dans lequel j'ai mis en œuvre 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> 

Je souhaite afficher complètement les cartes sur l'écran afin de les rendre plus claires et faciles à utiliser.Comme cela ne correspond pas à l'activité actuelle.

Répondre

0

Veuillez ajouter la propriété app:cardPreventCornerOverlap="false" à cardview. J'espère que ça marcherait.

+0

ne fonctionne pas votre ligne de code –

0

Je suppose que le XML est utilisé comme un élément pour ListView ou RecyclerView assurez-vous que le RecyclerView n'a aucune marge.

+0

beaucoup mieux après avoir enlevé le rembourrage de recyclerView. Mais pas aussi bon que je le demande. –

+0

mettre à jour la question avec 'RecyclerView' xml – Adarsh

+0

fait !! J'ai aussi ajouté le xml pour recyclerView –