سلام
یه سورس منو پیدا کردم وقتی با کمی تغییرات در شبیه ساز (یو ویو و لیپ دروید)باز کردم خوب بود
ولی وقتی در گوشی باز کردم جای ویو ها عوض شد
تصویر و کد را نگاه کنید
نمیدونم چرا اینجوریه
Dim sm As SlideMenu
Private Butmenu As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("laymain")
Activity.Color=Colors.Cyan
File.Copy(File.DirAssets,"test.db",File.DirInternal,"test.db")
sql.Initialize(File.DirInternal,"test.db",False)
curs=sql.ExecQuery("SELECT * FROM tbcar")
Button1.Text="گروه خودرو سازی سایپا خودرو"
Button2.Text="گروه خودرو سازی ایران خودرو"
rash.Initialize
rash.SetTextShadow(Button1,7,1,2,Colors.Red)
sm.Initialize(Activity, Me, "SlideMenu", 42dip, 180dip)
sm.AddItem("Item #1", LoadBitmap(File.DirAssets, "bomb.png"), 1)
sm.AddItem("Item #2", LoadBitmap(File.DirAssets, "book_add.png"), 2)
sm.AddItem("Item #3", LoadBitmap(File.DirAssets, "book_open.png"), 3)
sm.AddItem("Item #4", LoadBitmap(File.DirAssets, "wrench.png"), 4)
sm.AddItem("Item #5", LoadBitmap(File.DirAssets, "wrench_orange.png"), 5)
sm.AddItem("Item #6", Null, 6)
sm.AddItem("Item #7", Null, 7)
End Sub
Sub Butmenu_Click
sm.Show
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
'Pressing the back key while the slidemenu is open will close it
If KeyCode = KeyCodes.KEYCODE_BACK And sm.isVisible Then
sm.Hide
Return True
End If
'Pressing the menu key will open/close the slidemenu
If KeyCode = KeyCodes.KEYCODE_MENU Then
If sm.isVisible Then sm.Hide Else sm.Show
Return True
End If
End Sub
Sub SlideMenu_Click(Item As Object)
ToastMessageShow("Item clicked: " & Item, False)
End Sub
کدهای بالا داخل اکتویتی مین هست یه ماژول هم داره که کدهاش این(پایین)
'SlideMenu Class module
'
'Author: Markus Stipp
'Version: 1.0
'Class module
Private Sub Class_Globals
Type ActionItem (Text As String, Image As Bitmap, Value As Object)
Private mSlidePanel As Panel
Private mBackPanel As Panel
Private mModule As Object
Private mEventName As String
Private mListView As ListView
Private mInAnimation As Animation
Private mOutAnimation As Animation
End Sub
'Initializes the SlideMenu object
' Activity - Pass a reference to the Activity here where the Slidemenu should be added to.
' Module - The calling Module. Pass the "Me" reference here
' EventNAme - EventName for the Click event
' Top - Top position of the Menu.
' Width - Width of the menu
Sub Initialize(Activity As Activity, Module As Object, EventName As String, Top As Int, Width As Int)
mModule = Module
mEventName = EventName
mSlidePanel.Initialize("mSlidePanel")
mListView.Initialize("mListView")
mListView.TwoLinesAndBitmap.SecondLabel.Visible = False
mListView.TwoLinesAndBitmap.ItemHeight = 50dip
mListView.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER_VERTICAL
mListView.TwoLinesAndBitmap.Label.Height = mListView.TwoLinesAndBitmap.ItemHeight
mListView.TwoLinesAndBitmap.Label.Top = 0
mListView.TwoLinesAndBitmap.ImageView.SetLayout(13dip, 13dip, 24dip, 24dip)
mListView.Color = Colors.LightGray
mInAnimation.InitializeTranslate("", -Width,0, 0, 0)
mInAnimation.Duration = 200
mOutAnimation.InitializeTranslate("Out", Width, 0, 0, 0)
mOutAnimation.Duration = 200
Activity.AddView(mSlidePanel,0 , Top, Width, 80%y - Top)' \حدف زیادی های پایین منو
mBackPanel.Initialize("mBackPanel")
mBackPanel.Color = Colors.Transparent
Activity.AddView(mBackPanel, -100%x, 0, 100%x, 100%y)
mSlidePanel.AddView(mListView, 0, 0, mSlidePanel.Width, mSlidePanel.Height)
mSlidePanel.Visible = False
End Sub
'Adds an item to the SlideMenu
' Text - Text to show in menu
' Image - Image to show
' ReturnValue - The value that will be returned in the Click event
Public Sub AddItem(Text As String, Image As Bitmap, ReturnValue As Object)
Dim item As ActionItem
item.Initialize
item.Text = Text
item.Image = Image
item.Value = ReturnValue
If Not(Image.IsInitialized) Then
mListView.AddTwoLinesAndBitmap2(Text, "", Null, ReturnValue)
Else
mListView.AddTwoLinesAndBitmap2(Text, "", Image, ReturnValue)
End If
End Sub
'Show the SlideMenu
Public Sub Show
If isVisible = True Then Return
mBackPanel.BringToFront
mSlidePanel.BringToFront
mBackPanel.Left = 0
mSlidePanel.Left = 0
mSlidePanel.Visible = True
mInAnimation.Start(mSlidePanel)
End Sub
'Hide the SlideMenu
Public Sub Hide
If isVisible = False Then Return
mBackPanel.Left = -mBackPanel.Width
mSlidePanel.Left = -mSlidePanel.Width
mOutAnimation.Start(mSlidePanel)
End Sub
Private Sub Out_AnimationEnd
mSlidePanel.Visible = False
End Sub
Private Sub mBackPanel_Touch (Action As Int, X As Float, Y As Float)
If Action = 1 Then
Hide
End If
End Sub
Private Sub mListView_ItemClick (Position As Int, Value As Object)
Dim subname As String
Hide
subname = mEventName & "_Click"
If SubExists(mModule, subname) Then
CallSub2(mModule, subname, Value)
End If
End Sub
'Check if the menu is currently visible
Public Sub isVisible As Boolean
Return mSlidePanel.Visible
End Sub
سوال
KMOHAMMAD 10
سلام
یه سورس منو پیدا کردم وقتی با کمی تغییرات در شبیه ساز (یو ویو و لیپ دروید)باز کردم خوب بود
ولی وقتی در گوشی باز کردم جای ویو ها عوض شد
تصویر و کد را نگاه کنید
نمیدونم چرا اینجوریه
Dim sm As SlideMenu Private Butmenu As Button End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("laymain") Activity.Color=Colors.Cyan File.Copy(File.DirAssets,"test.db",File.DirInternal,"test.db") sql.Initialize(File.DirInternal,"test.db",False) curs=sql.ExecQuery("SELECT * FROM tbcar") Button1.Text="گروه خودرو سازی سایپا خودرو" Button2.Text="گروه خودرو سازی ایران خودرو" rash.Initialize rash.SetTextShadow(Button1,7,1,2,Colors.Red) sm.Initialize(Activity, Me, "SlideMenu", 42dip, 180dip) sm.AddItem("Item #1", LoadBitmap(File.DirAssets, "bomb.png"), 1) sm.AddItem("Item #2", LoadBitmap(File.DirAssets, "book_add.png"), 2) sm.AddItem("Item #3", LoadBitmap(File.DirAssets, "book_open.png"), 3) sm.AddItem("Item #4", LoadBitmap(File.DirAssets, "wrench.png"), 4) sm.AddItem("Item #5", LoadBitmap(File.DirAssets, "wrench_orange.png"), 5) sm.AddItem("Item #6", Null, 6) sm.AddItem("Item #7", Null, 7) End Sub Sub Butmenu_Click sm.Show End Sub Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Pressing the back key while the slidemenu is open will close it If KeyCode = KeyCodes.KEYCODE_BACK And sm.isVisible Then sm.Hide Return True End If 'Pressing the menu key will open/close the slidemenu If KeyCode = KeyCodes.KEYCODE_MENU Then If sm.isVisible Then sm.Hide Else sm.Show Return True End If End Sub Sub SlideMenu_Click(Item As Object) ToastMessageShow("Item clicked: " & Item, False) End Sub کدهای بالا داخل اکتویتی مین هست یه ماژول هم داره که کدهاش این(پایین) 'SlideMenu Class module ' 'Author: Markus Stipp 'Version: 1.0 'Class module Private Sub Class_Globals Type ActionItem (Text As String, Image As Bitmap, Value As Object) Private mSlidePanel As Panel Private mBackPanel As Panel Private mModule As Object Private mEventName As String Private mListView As ListView Private mInAnimation As Animation Private mOutAnimation As Animation End Sub 'Initializes the SlideMenu object ' Activity - Pass a reference to the Activity here where the Slidemenu should be added to. ' Module - The calling Module. Pass the "Me" reference here ' EventNAme - EventName for the Click event ' Top - Top position of the Menu. ' Width - Width of the menu Sub Initialize(Activity As Activity, Module As Object, EventName As String, Top As Int, Width As Int) mModule = Module mEventName = EventName mSlidePanel.Initialize("mSlidePanel") mListView.Initialize("mListView") mListView.TwoLinesAndBitmap.SecondLabel.Visible = False mListView.TwoLinesAndBitmap.ItemHeight = 50dip mListView.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER_VERTICAL mListView.TwoLinesAndBitmap.Label.Height = mListView.TwoLinesAndBitmap.ItemHeight mListView.TwoLinesAndBitmap.Label.Top = 0 mListView.TwoLinesAndBitmap.ImageView.SetLayout(13dip, 13dip, 24dip, 24dip) mListView.Color = Colors.LightGray mInAnimation.InitializeTranslate("", -Width,0, 0, 0) mInAnimation.Duration = 200 mOutAnimation.InitializeTranslate("Out", Width, 0, 0, 0) mOutAnimation.Duration = 200 Activity.AddView(mSlidePanel,0 , Top, Width, 80%y - Top)' \حدف زیادی های پایین منو mBackPanel.Initialize("mBackPanel") mBackPanel.Color = Colors.Transparent Activity.AddView(mBackPanel, -100%x, 0, 100%x, 100%y) mSlidePanel.AddView(mListView, 0, 0, mSlidePanel.Width, mSlidePanel.Height) mSlidePanel.Visible = False End Sub 'Adds an item to the SlideMenu ' Text - Text to show in menu ' Image - Image to show ' ReturnValue - The value that will be returned in the Click event Public Sub AddItem(Text As String, Image As Bitmap, ReturnValue As Object) Dim item As ActionItem item.Initialize item.Text = Text item.Image = Image item.Value = ReturnValue If Not(Image.IsInitialized) Then mListView.AddTwoLinesAndBitmap2(Text, "", Null, ReturnValue) Else mListView.AddTwoLinesAndBitmap2(Text, "", Image, ReturnValue) End If End Sub 'Show the SlideMenu Public Sub Show If isVisible = True Then Return mBackPanel.BringToFront mSlidePanel.BringToFront mBackPanel.Left = 0 mSlidePanel.Left = 0 mSlidePanel.Visible = True mInAnimation.Start(mSlidePanel) End Sub 'Hide the SlideMenu Public Sub Hide If isVisible = False Then Return mBackPanel.Left = -mBackPanel.Width mSlidePanel.Left = -mSlidePanel.Width mOutAnimation.Start(mSlidePanel) End Sub Private Sub Out_AnimationEnd mSlidePanel.Visible = False End Sub Private Sub mBackPanel_Touch (Action As Int, X As Float, Y As Float) If Action = 1 Then Hide End If End Sub Private Sub mListView_ItemClick (Position As Int, Value As Object) Dim subname As String Hide subname = mEventName & "_Click" If SubExists(mModule, subname) Then CallSub2(mModule, subname, Value) End If End Sub 'Check if the menu is currently visible Public Sub isVisible As Boolean Return mSlidePanel.Visible End Sub
لینک ارسال
به اشتراک گذاری در سایت های دیگر
4 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.