0

Ich bin neu in Android App-Entwicklung.Ich mache ein Projekt in Android-Studio. Ich will Farbe der Listenansicht setzen, wie Weiß und Farbe des Trennlinie genauso wie Code Hintergrund image.My unterHintergrundfarbe wie weiß von recyclerview und Trennlinie die gleiche Farbe wie das Hintergrundbild

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

Vom Layout fügen Sie auf dem Laufenden es mir scheint, sollten Sie dies achiveve mit einem nicht ** ** Listview, aber a ** RecyclerView **. Und das ist wichtig, weil ihr Verhalten und ihre Techniken sehr unterschiedlich sind. Daher sollten Sie Ihre Frage bearbeiten (Listenansicht durch Recyclerview ersetzen) und auch das Listenansichts-Tag entfernen. – nvi9

Antwort

1

Sie tun können, Verwendung wie itemdecoration als Link angebracht link

oder

können Sie Ansicht endlich Ihr Layout

<View 

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