0

Je suis nouveau dans le développement d'applications android.Je fais un projet dans android-studio. Je veux définir la couleur de listview comme la couleur de la ligne blanche et diviseur même que le code image.My de fond est inférieurdéfinir la couleur d'arrière-plan comme le blanc de recyclerview et la couleur de la ligne de séparation comme même que l'image de fond

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
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:layout_width="match_parent" 
android:layout_height="match_parent" 

android:background="@android:color/transparent" 
tools:context="com.example.litifer.litiferdemo.MainActivity"> 
<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/imageView" 
    android:src="@drawable/images1"/> 
<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"></android.support.v7.widget.RecyclerView</android.support.constraint.ConstraintLayout> 

list_item.xml

<?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="wrap_content"> 
<android.support.v7.widget.CardView 
    android:layout_margin="@dimen/cardview_default_radius" 
    android:layout_width="match_parent" 
    android:background="#FFFFFF" 
    android:layout_height="wrap_content"></android.support.v7.widget.CardView> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/textViewHead" 
     android:text="Heading" 
     android:textSize="20dp" 
     android:layout_marginTop="10dp" 
     android:layout_marginLeft="60dp" 
     android:layout_marginRight="40dp" 
     android:textAppearance="@android:style/TextAppearance.Large"/> 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/textViewDesc" 
     android:layout_marginTop="10dp" 
     android:layout_marginLeft="60dp" 
     android:layout_marginRight="40dp" 
     android:text="Description"/> 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:layout_marginLeft="60dp" 
     android:layout_marginRight="40dp" 
     android:id="@+id/textViewDate" 
     android:text="Date"/> 
</LinearLayout></LinearLayout> 
+0

De la mise en page que vous avez publié il me semble que vous voulez achiveve cela avec pas ** ListView **, mais ** RecyclerView **. Et cela compte, car leur comportement et leurs techniques sont très différents. Vous devriez donc éditer votre question (remplacer listview par recyclview) et supprimer aussi la balise listview. – nvi9

Répondre

1

vous pouvez faire en utilisant comme itemdecoration comme lien fixé link

ou

vous pouvez ajouter vue enfin à votre disposition

<View 

     android:layout_width="match_parent" 
     android:layout_height="@dimen/normal_margin1" 
     android:layout_marginTop="@dimen/normal_margin8" 
     android:background="@color/black12" />