سلام دوستان من ی سورس دارم ک تب ها به این شکل هستش و میخوام از حلقه خارج بشه و با کلیک رو هر کدوم یه لایوت رو لود کنه!
'This example shows how to use a custom xml layout for the tabs. Here we use icon and text which are aligned
'vertically as described in the material design guidelines. If you just add icon and text both will be aligned
'horizontally which is not styleguide conform. Maybe Google will change this behavior in the future.
'This example uses AHViewPager library, AppCompat library, DesignSupport library, XmlLayoutBuilder library,
'XmlViewEx class/library. Search for them on the forum.
#Region Project Attributes
#ApplicationLabel: Custom View for tabs
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\resource
#AdditionalRes: E:\tool\Basic4android\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: E:\tool\sdk\support\v7\recyclerview\res, android.support.v7.recyclerview
#AdditionalRes: E:\tool\sdk\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: E:\tool\sdk\support\design\res, android.support.design
#Extends: android.support.v7.app.AppCompatActivity
#CustomBuildAction: 1, c:\windows\system32\attrib.exe, +r res\*.* /s
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Size
Dim xx,yy As Double
xx = ((100%x)/320) / Density
yy = ((100%y)/480) / Density
For Each View As View In Activity.GetAllViewsRecursive
View.Width=(View.Width) * xx
View.Left=(View.left) * xx
View.Height=(View.Height) * yy
View.top=(View.top) * yy
Next
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private VP As AHViewPager
Private PC As AHPageContainer
Private TabLayout As DSTabLayout
Private ToolBar As ACToolBarLight
Dim titles(3) As String = Array As String ("تب 3", "تب 2", "تب1 ")
Dim icons(3) As String = Array As String ("lock_outline_white_24dp", "lock_open_white_24dp", "info_outline_white_24dp")
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("layout1")
'Initialize the Toolbar and set a title
ToolBar.SetAsActionBar
ToolBar.Title = "تایتل"
Dim xml As XmlLayoutBuilder
'Initialize a PageContainer Object with 3 pages. Each page contains a panel with different random color
PC.Initialize
For i = 0 To 2
Dim p As Panel
p.Initialize("")
' p.Color = Colors.RGB(Rnd(0,256), Rnd(0,256), Rnd(0,256))
'Don't add a title here
PC.AddPage(p, "")
Next
'Set the PageContainer for the ViewPager
VP.PageContainer = PC
'Set the Elevation for the Toolbar
Dim ac As AppCompat
ac.SetElevation(ToolBar, 4dip)
ac.SetElevation(TabLayout, 4dip)
'Set the tabmode to fixed and the gravity to fill
TabLayout.TabGravity = TabLayout.GRAVITY_FILL
TabLayout.TabMode = TabLayout.MODE_FIXED
'Set colors. The indicator color defaults to "colorAccent"
TabLayout.Color = ac.GetThemeAttribute("colorPrimary")
TabLayout.TabIndicatorColor = Colors.White
'Connect the TabLayout with the Viewpager.
'This will create the tabs and will keep tabs and pages
'in sync and creates a nice indicator animation.
TabLayout.SetViewPager(VP)
'Do the magic stuff for the custom tabs.
' - First we load an XML Layout file from the resources folder.
' - Then set the text and the icon drawable in this xml layout.
For i = 0 To 2
Dim v As View
v = XmlViewEx.InflateXmlLayout("tab_icon")
TabLayout.SetTabCustomView(i, v)
XmlViewEx.SetXmlViewText(XmlViewEx.FindView(v, "tabText"), titles(i).ToUpperCase)
XmlViewEx.SetXmlViewImage(XmlViewEx.FindView(v, "tabIcon"), xml.GetDrawable(icons(i)))
'XmlViewEx.SetXmlViewTextColor(XmlViewEx.FindView(v, "tabText"), Colors.Green)
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
سوال
Negan 1,300
سلام دوستان من ی سورس دارم ک تب ها به این شکل هستش و میخوام از حلقه خارج بشه و با کلیک رو هر کدوم یه لایوت رو لود کنه!
لینک ارسال
به اشتراک گذاری در سایت های دیگر
17 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.