10-10-2013، 08:59 PM
این مشکل برای چند کتابخونه دیگه هم پیش اومده.البته اسم اونا فرق میکنه.
یعنی اونا هم همینطورن؟
یعنی اونا هم همینطورن؟
امتیاز موضوع:
Title: اموزش برنامه نویسی اندروید به همراه تمامی ابزارها
حالت موضوعی |
Sub Process_Globals
Dim tmrAnimation As Timer
Dim currentPanelBeforePaused As Int
End Sub
Sub Globals
Dim sd As SlidingData 'The object that holds the data for SlidingPanels
Dim btnLeft, btnRight As Button
Dim startX, startY As Float
Dim SlidingDuration As Int
SlidingDuration = 500
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Create the panels.
'In this example we are just creating 8 "dummy" panels with different colors.
'You can instead load a different layout to each panel.
Dim panels(3) As Panel
For i = 0 To panels.Length - 1
panels(i).Initialize("panels")
panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "I'm Panel: " & i
lbl.TextSize = 20
lbl.TextColor = Colors.White
panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
Activity.AddMenuItem("Panel #" & i, "Menu")
Next
'add the Left and Right button
btnLeft.Initialize("Left")
btnLeft.Text = "Left"
Activity.AddView(btnLeft, 10%x, 100%y - 55dip, 100dip, 50dip)
btnRight.Initialize("Right")
btnRight.Text = "Right"
Activity.AddView(btnRight, 60%x, 100%y - 55dip, 100dip, 50dip)
'*****************************
'Initialize the SlidingData object and set the array of panels.
'Then we call SlidingPanels.Initialize to prepare the animation objects.
'The last call to ChangePanel brings the first panel.
sd.Initialize
sd.panels = panels
SlidingPanels.Initialize(sd, SlidingDuration)
sd.targetPanel = -1
sd.currentPanel = currentPanelBeforePaused - 1
ChangePanel(True) 'Current code expects the first call to be with Left = True.
End Sub
Sub Menu_Click
Log("menu_click")
Dim menu As String
menu = Sender
btnLeft.Enabled = False
btnRight.Enabled = False
JumpToPanel(menu.SubString("Panel #".Length))
End Sub
Sub Left_Click
ChangePanel(True)
End Sub
Sub Right_Click
ChangePanel(False)
End Sub
'**** These two subs are requred for handling the sliding ***
Sub ChangePanel(Left As Boolean)
'disable the buttons during the animation
btnLeft.Enabled = False
btnRight.Enabled = False
'Call SlidingPanels.ChangePanel to actually change the panels.
SlidingPanels.ChangePanel(sd, Left)
End Sub
Sub Animation1_AnimationEnd
'This event is raised when the animation finishes. You should call SlidingPanels.AnimationEnd from this sub.
SlidingPanels.AnimationEnd(sd)
If sd.targetPanel >= 0 Then
tmrAnimation.Enabled = True
Return 'we are still animating...
End If
'Enable the Left and Right buttons (unless there are no more panels).
'If sd.currentPanel = sd.panels.Length - 1 Then btnLeft.Enabled = False Else btnLeft.Enabled = True
'If sd.currentPanel = 0 Then btnRight.Enabled = False Else btnRight.Enabled = True
btnLeft.Enabled = True
btnRight.Enabled = True
End Sub
Sub tmrAnimation_Tick
tmrAnimation.Enabled = False
ContinueJumping
End Sub
'JumpToPanel can be used to navigate to a different panel which is not adjacent to the current one.
Sub JumpToPanel (Target As Int)
sd.targetPanel = Target
For i = 0 To 1
sd.leftAnimations(i).Duration = SlidingDuration / 2
sd.rightAnimations(i).Duration = SlidingDuration / 2
Next
ContinueJumping
End Sub
Sub ContinueJumping
If sd.targetPanel < 0 OR sd.targetPanel = sd.currentPanel Then
sd.targetPanel = -1
Animation1_AnimationEnd
For i = 0 To 1
sd.leftAnimations(i).Duration = SlidingDuration
sd.rightAnimations(i).Duration = SlidingDuration
Next
Return
End If
SlidingPanels.ChangePanel(sd, sd.targetPanel > sd.currentPanel)
End Sub
Sub Panels_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case Activity.ACTION_DOWN
startX = X
startY = Y
Case Activity.ACTION_UP
If Abs(Y - startY) > 20%y Then Return
If X - startX > 30%x AND btnRight.Enabled = True Then
ChangePanel(False)
Else If startX - X > 30%x AND btnLeft.Enabled = True Then
ChangePanel(True)
End If
End Select
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed = False Then
currentPanelBeforePaused = sd.currentPanel
Else
currentPanelBeforePaused = 0
End If
End Sub
(10-05-2012، 05:00 PM)'fadas133' نوشته: تو b4a نمیشه متن ها رو راست چین کرد ؟
مثلا textbox ها رو از راست پر میکنه
چه کار کنیم ؟؟؟
البته منظورم listview چه جوری گزینه هاشو راست چین کنیم ؟
lbl.Gravity=Bit.OR(Gravity.CENTER, Gravity.CENTER_HORIZONTAL)
(10-11-2013، 09:47 AM)'haji110' نوشته: وقتی دیباگ و ران میزنم خروجی نمیبینم.
راستی فایل APK تولید نمیشه که حداقل تو موبایل اجراش کنم.
(10-11-2013، 01:46 AM)'wikiccu' نوشته:درود بیکران بر مهندسانکد پیاچپی:Sub Process_Globals
Dim tmrAnimation As Timer
Dim currentPanelBeforePaused As Int
End Sub
Sub Globals
Dim sd As SlidingData 'The object that holds the data for SlidingPanels
Dim btnLeft, btnRight As Button
Dim startX, startY As Float
Dim SlidingDuration As Int
SlidingDuration = 500
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Create the panels.
'In this example we are just creating 8 "dummy" panels with different colors.
'You can instead load a different layout to each panel.
Dim panels(3) As Panel
For i = 0 To panels.Length - 1
panels(i).Initialize("panels")
panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "I'm Panel: " & i
lbl.TextSize = 20
lbl.TextColor = Colors.White
panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
Activity.AddMenuItem("Panel #" & i, "Menu")
Next
'add the Left and Right button
btnLeft.Initialize("Left")
btnLeft.Text = "Left"
Activity.AddView(btnLeft, 10%x, 100%y - 55dip, 100dip, 50dip)
btnRight.Initialize("Right")
btnRight.Text = "Right"
Activity.AddView(btnRight, 60%x, 100%y - 55dip, 100dip, 50dip)
'*****************************
'Initialize the SlidingData object and set the array of panels.
'Then we call SlidingPanels.Initialize to prepare the animation objects.
'The last call to ChangePanel brings the first panel.
sd.Initialize
sd.panels = panels
SlidingPanels.Initialize(sd, SlidingDuration)
sd.targetPanel = -1
sd.currentPanel = currentPanelBeforePaused - 1
ChangePanel(True) 'Current code expects the first call to be with Left = True.
End Sub
Sub Menu_Click
Log("menu_click")
Dim menu As String
menu = Sender
btnLeft.Enabled = False
btnRight.Enabled = False
JumpToPanel(menu.SubString("Panel #".Length))
End Sub
Sub Left_Click
ChangePanel(True)
End Sub
Sub Right_Click
ChangePanel(False)
End Sub
'**** These two subs are requred for handling the sliding ***
Sub ChangePanel(Left As Boolean)
'disable the buttons during the animation
btnLeft.Enabled = False
btnRight.Enabled = False
'Call SlidingPanels.ChangePanel to actually change the panels.
SlidingPanels.ChangePanel(sd, Left)
End Sub
Sub Animation1_AnimationEnd
'This event is raised when the animation finishes. You should call SlidingPanels.AnimationEnd from this sub.
SlidingPanels.AnimationEnd(sd)
If sd.targetPanel >= 0 Then
tmrAnimation.Enabled = True
Return 'we are still animating...
End If
'Enable the Left and Right buttons (unless there are no more panels).
'If sd.currentPanel = sd.panels.Length - 1 Then btnLeft.Enabled = False Else btnLeft.Enabled = True
'If sd.currentPanel = 0 Then btnRight.Enabled = False Else btnRight.Enabled = True
btnLeft.Enabled = True
btnRight.Enabled = True
End Sub
Sub tmrAnimation_Tick
tmrAnimation.Enabled = False
ContinueJumping
End Sub
'JumpToPanel can be used to navigate to a different panel which is not adjacent to the current one.
Sub JumpToPanel (Target As Int)
sd.targetPanel = Target
For i = 0 To 1
sd.leftAnimations(i).Duration = SlidingDuration / 2
sd.rightAnimations(i).Duration = SlidingDuration / 2
Next
ContinueJumping
End Sub
Sub ContinueJumping
If sd.targetPanel < 0 OR sd.targetPanel = sd.currentPanel Then
sd.targetPanel = -1
Animation1_AnimationEnd
For i = 0 To 1
sd.leftAnimations(i).Duration = SlidingDuration
sd.rightAnimations(i).Duration = SlidingDuration
Next
Return
End If
SlidingPanels.ChangePanel(sd, sd.targetPanel > sd.currentPanel)
End Sub
Sub Panels_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case Activity.ACTION_DOWN
startX = X
startY = Y
Case Activity.ACTION_UP
If Abs(Y - startY) > 20%y Then Return
If X - startX > 30%x AND btnRight.Enabled = True Then
ChangePanel(False)
Else If startX - X > 30%x AND btnLeft.Enabled = True Then
ChangePanel(True)
End If
End Select
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed = False Then
currentPanelBeforePaused = sd.currentPanel
Else
currentPanelBeforePaused = 0
End If
End Sub
میخواستم ببینم میشه به جای کد نویسی توی این کد از Designer استفاده کرد ؟
واضح تر بگم مبشه به جای لود کردن پنل توی دیزانر این کارو بکنم و به کد آسیبی نرسه و درست اجرا بشه؟
اگه آره چطوری؟
(10-10-2013، 08:59 PM)'haji110' نوشته: این مشکل برای چند کتابخونه دیگه هم پیش اومده.البته اسم اونا فرق میکنه.
یعنی اونا هم همینطورن؟
(10-12-2013، 01:05 PM)'seyedsharifi' نوشته: با درود
چطوری میتونم وقتی گوشی زنگ خورد دتکت کنم وشماره تلفن تماس گیرنده را بدست آورم
لطفا راهنمایی کنید