Problem with buttons and checkboxes in Ice Cream Sandwich

William Hunter

Active Member
Licensed User
Longtime User
I have a problem with the way buttons and checkboxes appear in Ice Cream Sandwich as compared to Froyo.

In Froyo buttons and checkboxes are silver gray, and have a nice 3D gradient with round corners. Buttons stand out on any background color, and when disabled the color change is clearly discernable. Checkboxes also stand out on any background color.

In ICS buttons are a washed out gray, with square corners and no 3D gradient. The color change when disabled is not clearly discernable. Checkboxes are simply a hollow white square rectangle. They show on a dark gray background but disappear on a white background. I have added the following line to the Manifest to see if things would improve. The checkboxes became black and show on a white background, but now disappear on a dark gray background.

SetApplicationAttribute(android:theme, @android:style/Theme.Holo.Light)

I am using B4A v2.30

My paths are:

C:\Program Files\Java\jdk1.7.0_04\bin\javac.exe

C:\Android\android-sdk\platforms\android-16\android.jar

Below is the Manifest file:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)
'End of default text.

I can’t use graphics to enhance the buttons because the user inputs button text. The checkboxes don’t show well enough over all background colors so as to be useful.

My question is this: Is this normal behavior for ICS that cannot be overcome, or is there something I should be doing differently? I would like to have the same high quality of buttons, checkboxes etc in ICS as in Froyo. Is this possible?

Any help would be greatly appreciated. :sign0085:
 
Last edited:

padvou

Active Member
Licensed User
Longtime User
I would lower the value of android:targetSdkVersion=
Or draw my own controls..
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
As above.

Setting targetSdkVersion to 8 will reverteverything back to the old style as though Holo never existed. Other than that, change the colors of the views to suit.

OR

You can set the theme per activity. So, for dark activities set the theme dark and for light activities set the theme light.

Just a note though, you need to be careful setting theme to holo as this will cause error on earlier versions of android. A solution is to set a custom theme that utilizes Holo where possible but also has a fall back for when Holo isn't available. See http://www.b4x.com/forum/basic4android-getting-started-tutorials/27624-theme-based-version-tutorial.html
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
Thank you both for your responses. I have set the targetSdkVersion to 8 in the Manifest, and have left my path set to the android-16 jar file. This has resolved the issue. I’ll do a little more experimentation with other targetSdkVersion values.

@barx – Thank you for the extra commentary re Holo. Your tutorial will be very helpful in the future. I’m not quite working at that level yet, but your tutorial certainly has shed light on what was formerly a mystery to me.

Best regards
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…