Android EditText with line
<p>I am looking to define an <code>EditText</code> with a line right under the text.</p>

<p>I have defined this piece of code to achieve this. Whilst it fits its purpose, I am wondering whether or not this is the best way to achieve this.</p>

<p>First, I have defined a shape in a drawable XML file called <code>text_item_layout.xml</code></p>

<pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shape"line"&gt;
    &lt;padding android:bottom="20dp" /&gt;
    &lt;stroke android:width="match_parent" android:color="@color/my_color"/&gt;
&lt;/shape&gt;
</code></pre>

<p>Then, I have defined style <code>edit_text_style</code> for the <code>EditText</code>: </p>

<pre><code>&lt;style name="my_edit_text" parent="@android:style/TextAppearance"&gt;
    &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt;
    &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
    &lt;item name="android:textColor"&gt;#00FF00&lt;/item&gt;
    &lt;item name="android:texdtSize"&gt;10dp&lt;/item&gt;
    &lt;item name="android:background"&gt;@drawable/text_item_layout&lt;/item&gt;
&lt;/style&gt;
</code></pre>
