Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do i get a gap between checkbox and text?

I am using image for checkbox. This is the xml i am uisng,

<CheckBox
    android:id="@+id/remember"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"        
    android:layout_below="@+id/tableLayout1"
    android:button="@drawable/checkbox_selector"
    android:layout_marginLeft="52dp"
    android:text="@string/remember"
    android:textColor="#000000" />

I am getting the gap between the image and text ( see in the below image), is it default; is it possible to change if yes let me know what property i have to add.

checkbox_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" 
    android:drawable="@drawable/checked" />
<item android:state_checked="false" 
    android:drawable="@drawable/un_checked" />
</selector>

enter image description here

like image 543
RajaReddy PolamReddy Avatar asked Feb 10 '12 04:02

RajaReddy PolamReddy


People also ask

How can I remove space between checkbox and text?

For IE, you need to set the height to remove the space between checkboxes. Show activity on this post. This is using a doctype of HTML 4.01 strict. if you want side-by-side borders for the checkboxes, use a height of 13px.

How do you put a space between checkbox and label?

Use margin-right .

How do you put a space between a checkbox and text in HTML?

If the intent of the user is to bring some more space between check box "box" and its corresponding text, you can use "&npsp;" in the Text content of the checkbox. Hope that helps.

How do you align checkboxes and their labels consistently cross browsers?

Checkbox inputs need to align vertically with the label text similarly (if not identically) across all browsers. If the label text wraps, it needs to be indented (so no wrapping down underneath the checkbox).


1 Answers

Try messing with the android:paddingLeft property of the checkbox.

See this post for further information: Android - Spacing between CheckBox and text

like image 143
Dan Avatar answered Sep 25 '22 20:09

Dan