Problems if the device is Horizontal

desof

Well-Known Member
Licensed User
Longtime User
Hi friends I have an app that behaves correctly if the device is open if vertically but not horizontally
I can not find what could be the problem
Here hit the code that I think is where the answer:

B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim ph As Phone
Dim bd As BitmapDrawable    
FileDAtos="config.dat"
Activity.LoadLayout("layout")
ph.SetScreenOrientation (1)    

If FirstTime=True Then 
    CargaImagen("banner2")
    compartir.Add ("Por E-Mail")
    compartir.Add ("Por Facebook")
    compartir.Add ("Por SMS")
    compartir.Add ("Salir")
    Splash
End If

bd = ph.GetResourceDrawable(17301569)
Activity.AddMenuItem2 ("Acerca de..","Acerca", bd.Bitmap)        
bd = ph.GetResourceDrawable(17301560)
Activity.AddMenuItem2("Salir","Salir", bd.Bitmap)    
End Sub

Sub Splash    
    wait(5)
    Dim bmp As Bitmap    
    bmp.Initialize(File.DirAssets,"fondo.jpg")
    imgFondo.SetBackgroundImage(bmp)
    imgFondo.Top=42dip
    imgFondo.Height =100%y-42dip    
    imgFondo.SendToBack 
    imgLogo.Visible=False
End Sub
 

derez

Expert
Licensed User
Longtime User
B4X:
ph.SetScreenOrientation (1)

This line makes the application run in portrait mode only. If your layout includes layout for both aspects then try to delete this line.
 
Upvote 0
Top