Problem with using ICS Holo style (dark)

corwin42

Expert
Licensed User
Longtime User
I'm trying to make my app look good on ICS devices.

I added the targetSDKVersion=11 and the Holo style to the manifest. This works as expected and my app gets the dark holo style on ICS devices now.

But there is a problem that edittexts and buttons still have their black text. Buttons are hard to read but for edittexts it is even worse. They now have a black background and black text.

I suggest that B4A will set the default text color to the system default color.

Another strange thing is that if I explicitly set Holo theme in Manifest editor with

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

I get the Holo Theme in my app but all multiline labels aren't multiline anymore. The whole text gets displayed in one line. Don't know if this is an emulator bug. I don't have a real ICS device.
 

corwin42

Expert
Licensed User
Longtime User
The problem with text color in buttons and edittext only occurs if you use the designer. If you create buttons/edittexts in code then they will have their default textcolor as expected. Even the text size is not the default size if you use the designer.

I think the designer should only set such values if you really change them.

The only workaround I found for this is to create dummy objects by code, get their color and textsize and apply the values to the designer objects.

Here is a small test Sub to assign the default style to buttons and edittext (needs to be expanded to other types):

B4X:
Sub SetDefaultStyle(act As Activity)
   Dim bt As Button
   Dim et As EditText
   bt.Initialize("")
   et.Initialize("")
   
   Dim myView As View
   Dim myLabel As Label

   For i = 0 To act.NumberOfViews - 1
      myView = act.GetView(i)
      
      If myView Is Button Then
         myLabel = myView
         myLabel.TextColor = bt.TextColor
         myLabel.TextSize = bt.TextSize
      Else If myView Is EditText Then
         myLabel = myView
         myLabel.TextColor = et.TextColor
         myLabel.TextSize = et.TextSize
      End If
   Next
End Sub

The problem is if you really want to change the color or text size you can't do this in the designer anymore if you use such a "fixit" sub.

Best thing would be if the designer will support this directly.
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
First, I would like to say some words before I get to the actual topic. I am a bit relieved to see that other people are also raising issues similar to mine when switching to Android 4.0 theme. No don't take me wrong I am not saying that I am happy, its just that when experienced and senior programmers like @corwin42 and @thedesolatesoul are experiencing issues like junior and not so experienced programmers like myself. I have been working on this project for quite a while now for my work. And recently I changed it to ICS layout/themed, and faced issues same as discussed in this thread. Well I hope with the help of each other we will solve various issues with the ICS. Don't take me wrong, I am not against Android 4.0 or anything, in fact I love the new layout and themes of the OS...
Now, about the topic, the first issue I faced after going ICS way is the httpClient problem. 90% of my app is about connecting to network and fetch information but then I discovered that its the ICS threading issue that causes it. Then, I started changing all the httpClients to httpUtils. After the first activity went fine, I proceeded with changing in the services but experienced some problems, then Erel released httpUtils2, then I changed again to httpUtils2 (this time it wasn't that much difficult as the use of classes made it so much easier and programmer friendly). At the moment I am facing the theme problem. At the end I would like to say to all Thank you all for your help and efforts in making a basic4android a good, strong community.
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
Well I just tested my app and I am facing the same issue as yours. The multi-line labels are not multi-line any more. Have you found any fix yet?
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
I'm unable to reproduce this issue. Can you upload a small project that demonstrates it?

Hi Erel, I have attached a test project replicating the issue. If you run it in ICS device/emulator, the label will be multi-line. However, if you run it on Android 2.3.3 device/emulator. it doesn't continues to the next line.
 

Attachments

  • emulatorScreenshot.png
    emulatorScreenshot.png
    13.9 KB · Views: 401
  • multiLineLabelTest.zip
    7 KB · Views: 214
  • 2012-06-29 09.46.34.png
    2012-06-29 09.46.34.png
    44.9 KB · Views: 386
Upvote 0
Top