user3331287
user3331287

Reputation:

How to remove Margin from edit Text

As you can see on below image, edit text is having some margin, i want to remove it.

 <ImageView 
        android:id="@+id/imageview_user_image_1"
        android:layout_width="23dp"
        android:layout_height="23dp"
        android:layout_marginLeft="5dp"
        android:layout_centerVertical="true"

        android:scaleType="fitXY"
        android:background="@drawable/smile"/>
    <EditText 
        android:id="@+id/login_user_name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:layout_toRightOf="@+id/imageview_user_image_1"
        android:layout_marginLeft="5dp"
        android:layout_centerVertical="true"
        android:singleLine="true"
        android:textColorHint="#808080"
        android:hint="@string/userid"/>
![problem image][1]

enter image description here target image

Upvotes: 1

Views: 3267

Answers (2)

Mansi
Mansi

Reputation: 1949

Try This

<ImageView 
    android:id="@+id/imageview_user_image_1"
    android:layout_width="23dp"
    android:layout_height="23dp"
    android:layout_marginLeft="5dp"
    android:layout_centerVertical="true"

    android:scaleType="fitXY"
    android:background="@drawable/smile"/>
<EditText 
    android:id="@+id/login_user_name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="10dp"
    android:layout_toRightOf="@+id/imageview_user_image_1"
    android:layout_margin="0dp"
    android:background="@android:color/transparent"
    android:layout_centerVertical="true"
    android:singleLine="true"
    android:textColorHint="#808080"
    android:hint="@string/userid"/>

add android:background="@android:color/transparent" in edittext

Upvotes: 3

i.n.e.f
i.n.e.f

Reputation: 1803

As per Mario Stoilov Said, try this code

 <ImageView 
    android:id="@+id/imageview_user_image_1"
    android:layout_width="23dp"
    android:layout_height="23dp"
    android:layout_marginLeft="0dp"
    android:layout_centerVertical="true"
    android:scaleType="fitXY"
    android:background="@drawable/home_icon"/>
<EditText 
    android:id="@+id/login_user_name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/imageview_user_image_1"
    android:layout_marginLeft="0dp"
    android:layout_centerVertical="true"
    android:singleLine="true"
    android:textColorHint="#808080"
    android:hint="hi"/>

by Changing to this android:layout_marginLeft="0dp" hope this helps you.

Upvotes: 0

Related Questions