Issue with Nexus 7 emulator on Android 4.2

Thomas Wong

Member
Licensed User
Longtime User
Hi,

I tried the OneLayoutStreched.b4a (comes with guide.zip) on Nexus 7 emulator (Android 4.2). But it won't display any text.
I attached the screenshot for the emulator and it's screen output.

nexus7-screen.png

nexus7-avd-detail.png

I tried it on a 7" tablet (ICS 4.0.3) and 10" tablet (Android 4.1.2) and worked well. So does it mean the issue with Android 4.2?

Any idea what maybe wrong?

--thomas
 

Mahares

Expert
Licensed User
Longtime User
The Nexus 7 has a scale of 1.33 and not 1.5. Therefore, I changed the code part in the below sub as shown below and it works and shows me all the text. See the first few lines of the sub where I made the changes:
B4X:
Sub CheckDeviceType
   ' check device type, used to define text sizes
   ' should be completed if necessary

   lv = GetDeviceLayoutValues
   
   Dim MyScale As Double
   MyScale=lv.Scale
   If MyScale>1.3 AND MyScale<=1.5 Then
      MyScale=1.5
   End If
   Select MyScale
   
   Case 2
      DeviceType = "Smartphone 5"
      TextSizeRatio = 1.5
   Case 1.5
      If lv.Width > 1100 Then
         DeviceType = "Tablet 7"
         TextSizeRatio = 2
      Else
         DeviceType = "Smartphone 3.5"
         TextSizeRatio = 1
      End If
   Case 1
      If lv.Width > 1100 Then
         DeviceType = "Tablet 10"
         TextSizeRatio = 3
      Else If lv.Width < 600 Then
         DeviceType = "Smartphone 3.5"
      Else
         DeviceType = "Tablet 7"
         TextSizeRatio = 2
      End If
   End Select
   
End Sub
 
Upvote 0

Thomas Wong

Member
Licensed User
Longtime User
I tried using AutoScaleAll but the result is not consistent.
Label text will be resize correctly.
Button text is smaller than label text.
RadioButton text is even smaller than the text for Button.
This happened on both Tablet 7" (4.0.3) and Nexus 7 emulator.

attachment.php


Any idea? :sign0163:
 

Attachments

  • different_text_size.png
    different_text_size.png
    64.7 KB · Views: 396
Upvote 0
Top