0

I currently have a TextView sitting below a ListView and would like to theme the TextView so that it looks like an item in the list (e.g. with top and bottom gray border). What's the best way to accomplish this?

zer0stimulus
  • 22,306
  • 30
  • 110
  • 141

1 Answers1

2

Create a drawable xml file to create a shape with a gradient background.

textview_background.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<gradient
    android:startColor="#333"
    android:centerColor="#000"
    android:endColor="#676"
    android:angle="270"/>

<stroke
    android:width="2dp"
    android:color="#80808080"/>



</shape>

save in your drawable directory and refer to as

   android:background="@drawable/textview_background"

in your layout for a background of what you want to use. Text view, layout, button...

This should give you something close to what your looking for I think.

The colors used in the gradient are triple hex, i think you can use normal hex.

Wayner
  • 3,303
  • 1
  • 16
  • 10