رفتن به مطلب

آموزش ساخت اسلاید منوی ساده و زیبا


bahman

ارسال‌های توصیه شده

سلام

بدون مقدمه میریم سراغ اموزش

 

اول تو ساب گلوبال منومون رو تعریف میکنیم

Dim ft As Typeface = Typeface.LoadFromAssets("yekan.ttf")
Dim sm As SlidingMenu

سپس کد زیر رو میزاریم اکتیویتی کریتمون

sm.Initialize("sm")
	Dim offset As Int = 100dip
	sm.BehindOffset = offset
	sm.Mode = sm.left
	sm.Menu.Color=Colors.RGB(10,128,67)

	Dim b1, b2, b3, b4, b5 , b6 As Label
	b1.Initialize("b1")
	b2.Initialize("b2")
	b3.Initialize("b3")
	b4.Initialize("b4")
	b5.Initialize("b5")
	b6.Initialize("b6")
	b1.Text =  "تست "
	b1.textColor=Colors.white
	b1.Typeface=ft
	b2.Text = "راهنما"
	b2.textColor=Colors.white
	b2.Typeface=ft
	b3.Text = "ارسال نظرات"
	b3.textColor=Colors.white
	b3.Typeface=ft
	b4.Text = "برنامه های ما"
	b4.textColor=Colors.white
	b4.Typeface=ft
	b5.Text = "درباره توسعه دهنده"
	b5.textColor=Colors.white
	b5.Typeface=ft
	b6.Text = "خروج"
	b6.textColor=Colors.white
	b6.Typeface=ft
	sm.Menu.AddView(b1, 10dip, 10dip, 100%x - offset - 20dip, 50dip)
	sm.Menu.AddView(b2, 10dip, 60dip, 100%x - offset - 20dip, 50dip)
	sm.Menu.AddView(b3, 10dip, 110dip, 100%x - offset - 20dip, 50dip)
	sm.Menu.AddView(b4, 10dip, 160dip, 100%x - offset - 20dip, 50dip)
	sm.Menu.AddView(b5, 10dip, 210dip, 100%x - offset - 20dip, 50dip)
	sm.Menu.AddView(b6, 10dip, 260dip, 100%x - offset - 20dip, 50dip)
	

ساب های زیر رو اضافه میکنیم جهت نمایش منو

Sub lv1_ItemClick (Position As Int, Value As Object)
   Log(Value)
   sm.HideMenus
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
   If KeyCode = KeyCodes.KEYCODE_BACK And sm.Visible Then
     sm.HideMenus
     Return True
   End If
   Return False
End Sub
Sub Activity_KeyUp (KeyCode As Int) As Boolean
    
    If KeyCode=KeyCodes.KEYCODE_MENU And sm.Visible=False Then
        sm.ShowMenu
    
 Else If KeyCode=KeyCodes.KEYCODE_MENU And sm.Visible=True Then
        sm.HideMenus
    End If
End Sub


و در نهایت هر باتن بالا رو اینجوری کد میدیم

Sub B1_Click
   Log("b1_click")
   sm.HideMenus
End Sub

فونت یکان رو تو فایلاتون قرار بدین

 

 

 

پسندیدم هم اگه پسندیدین یادتون نره

 

output_AoOx4u.gif

menuu.rar

لینک ارسال
به اشتراک گذاری در سایت های دیگر

لطفا سورس رو پیوست کنید خطا میده

B4A version: 5.80
Parsing code.    (0.00s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.00s)
Generating R file.    (0.15s)
Compiling generated Java code.    Error
javac 1.6.0_04
src\b4a\example\main.java:313: cannot find symbol
symbol  : class SlidingMenuWrapper
location: package anywheresoftware.b4a.objects
public anywheresoftware.b4a.objects.SlidingMenuWrapper _sm = null;
                                   ^
Note: src\b4a\example\starter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

لینک ارسال
به اشتراک گذاری در سایت های دیگر

 

لطفا سورس رو پیوست کنید خطا میده

B4A version: 5.80
Parsing code.    (0.00s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.00s)
Generating R file.    (0.15s)
Compiling generated Java code.    Error
javac 1.6.0_04
src\b4a\example\main.java:313: cannot find symbol
symbol  : class SlidingMenuWrapper
location: package anywheresoftware.b4a.objects
public anywheresoftware.b4a.objects.SlidingMenuWrapper _sm = null;
                                   ^
Note: src\b4a\example\starter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

سورس پیوست شد

لینک ارسال
به اشتراک گذاری در سایت های دیگر

با دستکاری این 2 کد هم میتونین رنگ و راست و چپ بودن منو رو تغییر بدین

	sm.Mode = sm.left
	sm.Menu.Color=Colors.RGB(10,128,67)
لینک ارسال
به اشتراک گذاری در سایت های دیگر

  • 5 ماه بعد...

سلام -

ای کاش اندازه فونت هم میگفت ....

لینک ارسال
به اشتراک گذاری در سایت های دیگر

بایگانی شده

این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.

  • کاربران آنلاین در این صفحه   0 کاربر

    • هیچ کاربر عضوی،در حال مشاهده این صفحه نیست.
×
×
  • اضافه کردن...