How to adjust the size of "CheckBox" view?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to adjust the size of "CheckBox" view?

Postby bercago » Fri Jan 23, 2009 10:57 am

Hello~
Now I am tring to create a ListView, which each row of the ListView contains a CheckBox view.
In ListAdapter.getView(), I return a CheckBox view.

The functionality is fine, but the height of each row of ListView is too big,
I tried to downsize the height. But I can not find a way to reduce the size of
CheckBox view (I think the height of the row of the ListView is actually dominated
by the size of CheckBox view inside). I tried to set the padding of the CheckBox view, but it doesn't work.
And I can not find a way to reduce the image size of the "checkable box" of CheckBox view
(do I need to write my own CheckBox view? Gosh....)

My UI requirement is to display exactly 4 rows a page,
if the ListView contains only TextView, I can adjust the TextView size to let each page contains 4 lines,
but if the ListView contains CheckBox view, I can not adjust it size to fit UI requirement.

Need your help, Thanks very much.
bercago
Freshman
Freshman
 
Posts: 9
Joined: Thu Dec 18, 2008 11:38 am

Top

Postby darolla » Sun Jan 25, 2009 2:46 pm

hi,

the trick is using themes. if you understand how to modify your checkboxes (using other gfx) you get rid of this problem.

please take a look at: making_own_theme-t4052.html

I suggest: android-sdk-windows-1.0_r2toolslibresdefaultdrawable:

checkbox.xml
checkbox_background.xml
checkbox_label_background.9.png
checkbox_off_background.png
checkbox_off_background_focus_yellow.png
checkbox_on_background.png
checkbox_on_background_focus_yellow.png

these files I've attached as as zip for you...

greetings,
darolla

btw: this minimum size of a widget is the gfx at is minimum (it's stretched if its content is bigger using the .9.png feature...)
Attachments
checkbox_on_background.png
checkbox_on_background.png (3.28 KiB) Viewed 4057 times
small_checkbox.zip
(17.85 KiB) Downloaded 419 times
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby darolla » Sun Jan 25, 2009 2:47 pm

maybe you should use a simple main.xml with your own checkboxes first. then you can manipulate the row.xml for each list item...

greetings,
darolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby darolla » Sun Jan 25, 2009 7:33 pm

hi mate,

in order to help you I wrote this tutorial: http://www.anddev.org/viewtopic.php?p=17050

Greetings,
DaRolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby bercago » Mon Feb 02, 2009 5:32 am

Hi darolla,
Sorry for the late reply,
thanks for your help!

It is very helpful and let me understand the way that Android handle resources and layout.

Thanks again!
bercago
bercago
Freshman
Freshman
 
Posts: 9
Joined: Thu Dec 18, 2008 11:38 am

Postby darolla » Tue Feb 17, 2009 11:58 am

you're welcome :D
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests