sunskin
sunskin

Reputation: 1680

how to change the color of the border line of listview in a list detail layout?

how to change the color of the border line of listview in a list detail layout? It is always a black line that seperates listview and detailview in large screens (tablets). Not sure where it is set or how to set a new value. I want to change it to grey color.

This is my activity_items.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:showDividers="middle"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/fragmentItemsList"
        android:name="com.demo.ListFragment"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:color="#757872"
        tools:layout="@layout/fragment_items_list"
        />

    <View android:background="#000000"
        android:layout_width="1dp" 
        android:layout_height="wrap_content"
        />

    <FrameLayout
        android:id="@+id/flDetailContainer"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2"
        />


</LinearLayout>

Upvotes: 0

Views: 399

Answers (2)

Rohit5k2
Rohit5k2

Reputation: 18112

If you set black you will get black only. If you want grey color you need to set color as grey. Android can read what you have written in you code, can't read your mind. :D

Do this

<View android:background="#BDBDBD"
    android:layout_width="1dp" 
    android:layout_height="wrap_content"/>

To change the list view separator color do this

android:divider="#BDBDBD"
android:dividerHeight="1dp"

in your list view

Upvotes: 1

Clover
Clover

Reputation: 34

<View android:background="#000000"

Just change the code (000000) to match the color you want to use.

Upvotes: 0

Related Questions