chimbu
chimbu

Reputation: 806

How to set the border color for linear layout

I want to set set the border color white for linear layout but no inner color.

Here is my code that display the inner color black. Where is the mistake?

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:left="0dp" android:right="0dp"  android:top="-10dp" android:bottom="-10dp"> 
        <shape android:shape="rectangle">
            <stroke android:width="1dp" android:color="#ffffff" />
        </shape>
    </item>  
</layer-list> 

Upvotes: 1

Views: 5583

Answers (4)

Ali Ahmad
Ali Ahmad

Reputation: 1351

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" 
    >
    <solid  android:color="color_that_u_want_in background" />
    <stroke android:width="1dp"
        android:color="#ffffff"/>

</shape>

use this

Upvotes: 0

Jagadesh Seeram
Jagadesh Seeram

Reputation: 2664

Set this to your LinearLayout background

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

  <stroke
    android:width="1dp"
    android:color="#ffffff" />

  <solid android:color="#000000" />
</shape>

Upvotes: 0

Pankaj Kumar
Pankaj Kumar

Reputation: 83028

Add <solid android:color="@android:color/transparent" /> into shape tag.

<shape android:shape="rectangle" >

    <solid android:color="@android:color/transparent" />
</shape>

Upvotes: 3

Tim Kranen
Tim Kranen

Reputation: 4222

android:color="#ffffff" 

should be:

android:color="#000000"

The current color code is set to white instead of black.

Upvotes: 0

Related Questions