Question: I have an edittext for which I want to set below background![enter image description here](https://i.stack.imgur.com/xgiFQ.png)

but when I set this as background it stretches itself to fit in whole EditText like below image.![enter image description here](https://i.stack.imgur.com/70GuR.png)

and below is my code for xml file for editext

```
<LinearLayout
    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:visibility="visible" >

    <EditText
        android:id="@+id/comment"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:layout_weight="1"
        android:hint="@string/add_your_comment"
        android:imeOptions="actionDone"
        android:padding="5dp"
        android:background="@drawable/bg_search_field"
        android:scrollHorizontally="true"
        android:singleLine="true" />

    <ImageView
        android:id="@+id/post_comment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:padding="5dp"
        android:layout_marginRight="@dimen/fifteen_dp"
        android:src="@drawable/tick_selection" />
</LinearLayout>

```

How can I set the background correctly?

Answer: 
Ok So issue resolved simply by using nine patch image i have got from actionBarsherlock library which is using it for it's search view.
This line.-

```
android:layout_weight="1"

```

makes your `TextView` fill the empty width in the `LinearLayout`. Just try and remove it. You should also replace

```
android:padding="5dp"

```

for

```
android:layout_margin="5dp"

```