Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove this space in editText?

Here is my code for xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white_smoke"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <include layout="@layout/header" />

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true" >

            <TextView
                android:id="@+id/tvAddContact"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:background="@drawable/circle_trans"
                android:gravity="center"
                android:text="@string/plus_text"
                android:textColor="@color/white_smoke"
                android:textSize="40sp" />
        </FrameLayout>
    </RelativeLayout>

    <include
        layout="@layout/header_date"
        android:paddingTop="10dp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:paddingBottom="10dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="5dp" >

        <RadioGroup
            android:id="@+id/radioGroup1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@+id/rbDownline"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:button="@drawable/btn_radio_selector"
                android:checked="true"
                android:text="@string/rb_downline"
                android:textColor="@color/my_holo_text" />

            <RadioButton
                android:id="@+id/rbCustomer"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:button="@drawable/btn_radio_selector"
                android:checked="false"
                android:text="@string/rb_customer"
                android:textColor="@color/my_holo_text" />

        </RadioGroup>

        <EditText
            android:id="@+id/edSearchBox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="30dp"
            android:background="@drawable/gradient_ed_bg"
            android:drawableLeft="@drawable/search"
            android:hint="@string/search_contacts"
            android:imeOptions="actionDone"
            android:padding="8dp"
            android:singleLine="true"
            android:textColorHint="@color/my_holo_trans" />

        <ListView
            android:id="@+id/listContacts"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/gradient_bg_list_view_round"
            android:cacheColorHint="#00000000"
            android:divider="#149DCF"
            android:dividerHeight="1dp"
            android:listSelector="@drawable/list_selector_match_holo"
            android:paddingBottom="5dp"
            android:paddingTop="5dp" >

            <requestFocus />
        </ListView>
    </LinearLayout>

    <include layout="@layout/actionbar_title" />

</LinearLayout>

This xml shows output as following image,

enter image description here

As you can see that I am displaying an image in EditText box. I want to remove those padding type space ( marked as red ).

What should I do to remove it ?

like image 440
user2060383 Avatar asked Oct 31 '22 23:10

user2060383


2 Answers

use

android:drawablePadding="-2dip"

or whatever value do you need. Since you are using the drawableLeft item, you need the drawablePadding item as well, to adjust its padding

like image 126
Blackbelt Avatar answered Nov 08 '22 05:11

Blackbelt


use

android:drawablePadding="10dp"
like image 28
Amin Avatar answered Nov 08 '22 04:11

Amin