1

i have tried out the suggestions given but unable to reduce the size...on reduction of size in graphical layout,the border lines of the checkbox disappear...iam new to android...any help will be appreciated

thanks

here is code...

   <LinearLayout

 xmlns:android="http://schemas.android.com/apk/res/android"

   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="#F3CAE5"
   android:gravity="center_vertical"
   android:orientation="horizontal"
   android:padding="8dp" >

<CheckBox
    android:id="@+id/cb"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
     />

<TextView
    android:id="@+id/txt_id"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:textColor="#000" />





<TextView
    android:id="@+id/txt_fName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:textColor="#000" />





  </LinearLayout>

height and width change removes the border lines...check box appears in a list view that is populated dynamically...

the below code works for changing the checkbox image but now iam unable to check the box ie the tick mark does not appear on checking the box???

user
  • 11
  • 4
  • have you tried to give the height like 2dp or 3dp ?? – Umair Aug 27 '14 at 05:53
  • Please post some screenshots so that one can understand your problem. which suggestion you have tried? – GrIsHu Aug 27 '14 at 05:53
  • I think you have to place your custom image for that. here is the link. http://stackoverflow.com/a/7783892/1395259 – Narendra Pal Aug 27 '14 at 05:55
  • the below code works for changing the checkbox image but now iam unable to check the box ie the tick mark does not appear on checking the box... – user Aug 27 '14 at 09:01

2 Answers2

0

The text determines the size of the check box. try this:

<CheckBox 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:text="new checkbox" 
    ....... />
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
0

use custom image for check box and use image of your size

<CheckBox
    android:id="@+id/cb"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
android:button="@drawable/checkbox_selector" />


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

  android:drawable="@drawable/unchecked" />
 <item android:state_checked="true"
  android:drawable="@drawable/checked" />
</selector>
NavinRaj Pandey
  • 1,674
  • 2
  • 26
  • 40