0

This XML:

<TextView
    android:text="@string/verify_code_upc"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_row="1"
    android:layout_column="0"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#000080" />

<EditText
    android:id="@+id/editTextUPC"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:background="#ffcb05"
    android:layout_row="1"
    android:layout_column="1"
    android:layout_columnSpan="5" />

...shows this:

enter image description here

But adding this:

android:background="#ffcb05"

...to the EditText causes the entire EditText to "disappear":

enter image description here

Why?

UPDATE

If I give it an explicit width:

android:width="240dp"

...it does display:

enter image description here

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • you are wrapping the content when there is no content in an empty EditText field. Try setting your width to match_parent – zgc7009 May 19 '14 at 19:13

2 Answers2

1

Because the color does not have a size. Color drawables do not have a specific size, so you have to give it one. Another alternative would be to use a drawable instead of a color.

1

change your EditText to

<EditText android:id="@+id/editTextUPC" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="#ffcb05" android:layout_row="1" android:layout_column="1" android:hint="Hint occupying space" android:layout_columnSpan="5" />

or change the

 android:layout_width="match_parent"
android_Muncher
  • 1,057
  • 7
  • 14