Hi
Just started out with a simple app to try some features of B4A.
Am still finding my feet.. with this.
I have run into some basic problems.
What I am trying to achieve is:
1. Have a circle expanding from the centre (animation)
2. To be able to resize to all devices centred on the screen
3. Have a label displayed that is big enough on the device,center aligned and mutli-line flowing
Is this possible..
I am getting the following problems.
ImageView has a white background -Label does not show fully and text does not centre align (paragraph alignment)
Code is given below... please let me know what I am doing wrong or what needs to be changed.
Regards
Ramesh
Designer setting for image view attached
================================
'Activity module
Sub Process_Globals
Dim SP As MediaPlayer
Dim LoadId1, PlayId1 As Int
End Sub
Sub Globals
Dim ImageView1 As ImageView
Dim a5 As Animation
Dim AdView1 As AdView
Dim Label1 As Label
Dim Label2 As Label
Dim ScrollView1 As ScrollView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
AdView1.Initialize("Ad", "xxxx") 'publisher id that you received from AdMob.
'AdView1.SetTestDevice(Array As String("xxx"))
Dim Back1 As Bitmap
Dim pearl As Bitmap
Back1.Initialize(File.DirAssets, "back1.png")
pearl.Initialize(File.DirAssets, "xxxl1.png")
Activity.SetBackgroundImage(Back1)
Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)
AdView1.LoadAd
AdView1.BringToFront
If FirstTime Then
SP.Initialize2("sp")
SP.Load(File.DirAssets, "music_1.mp3")
SP.Play
SP.Looping = True
End If
Activity.LoadLayout("1")
a5.InitializeScaleCenter("", 0.5, 0.5, 1, 1, ImageView1)
'ImageView1.SetBackgroundImage(pearl)
ImageView1.Bitmap = pearl
Label1.Text= "Love"
Label1.TextSize = 28.0
Label2.Text ="Many Many Happy Returns of the Day"
Label2.TextSize = 28.0
Dim animations() As Animation
animations = Array As Animation(a5)
For i = 0 To animations.Length - 1
animations(i).Duration = 10000
animations(i).RepeatCount = 1
Next
End Sub
Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("failed: " & ErrorCode)
Msgbox("Failed","")
End Sub
Sub Ad_ReceiveAd
Log("received")
Msgbox("Ad Received","")
End Sub
Sub Ad_AdScreenDismissed
Log("screen dismissed")
End Sub
Sub ImageView1_Click
a5.Start(ImageView1)
End Sub
Just started out with a simple app to try some features of B4A.
Am still finding my feet.. with this.
I have run into some basic problems.
What I am trying to achieve is:
1. Have a circle expanding from the centre (animation)
2. To be able to resize to all devices centred on the screen
3. Have a label displayed that is big enough on the device,center aligned and mutli-line flowing
Is this possible..
I am getting the following problems.
ImageView has a white background -Label does not show fully and text does not centre align (paragraph alignment)
Code is given below... please let me know what I am doing wrong or what needs to be changed.
Regards
Ramesh
Designer setting for image view attached
================================
'Activity module
Sub Process_Globals
Dim SP As MediaPlayer
Dim LoadId1, PlayId1 As Int
End Sub
Sub Globals
Dim ImageView1 As ImageView
Dim a5 As Animation
Dim AdView1 As AdView
Dim Label1 As Label
Dim Label2 As Label
Dim ScrollView1 As ScrollView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
AdView1.Initialize("Ad", "xxxx") 'publisher id that you received from AdMob.
'AdView1.SetTestDevice(Array As String("xxx"))
Dim Back1 As Bitmap
Dim pearl As Bitmap
Back1.Initialize(File.DirAssets, "back1.png")
pearl.Initialize(File.DirAssets, "xxxl1.png")
Activity.SetBackgroundImage(Back1)
Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)
AdView1.LoadAd
AdView1.BringToFront
If FirstTime Then
SP.Initialize2("sp")
SP.Load(File.DirAssets, "music_1.mp3")
SP.Play
SP.Looping = True
End If
Activity.LoadLayout("1")
a5.InitializeScaleCenter("", 0.5, 0.5, 1, 1, ImageView1)
'ImageView1.SetBackgroundImage(pearl)
ImageView1.Bitmap = pearl
Label1.Text= "Love"
Label1.TextSize = 28.0
Label2.Text ="Many Many Happy Returns of the Day"
Label2.TextSize = 28.0
Dim animations() As Animation
animations = Array As Animation(a5)
For i = 0 To animations.Length - 1
animations(i).Duration = 10000
animations(i).RepeatCount = 1
Next
End Sub
Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("failed: " & ErrorCode)
Msgbox("Failed","")
End Sub
Sub Ad_ReceiveAd
Log("received")
Msgbox("Ad Received","")
End Sub
Sub Ad_AdScreenDismissed
Log("screen dismissed")
End Sub
Sub ImageView1_Click
a5.Start(ImageView1)
End Sub