kungsoft
New Member
B4A 版本号: 10.90
解析代码。 (0.00s)
Java 版本号: 11
Building folders structure. (0.04s)
编译代码。 (0.01s)
编译布局文件代码。 (0.04s)
管理类库文件。 (0.04s)
(AndroidX SDK)
Compiling resources (1.75s)
Linking resources (1.51s)
编译生成的Java源码。 Error
B4A line: 62
TabLayout.SetViewPager(VP)
src\example\newviewpager\scrollingtabs\main.java:374: 错误: 无法访问ViewPager
mostCurrent._tablayout.SetViewPager((androidx.viewpager.widget.ViewPager)(mostCurrent._vp.getObject()));
^
找不到android.support.v4.view.ViewPager的类文件
注: src\example\newviewpager\scrollingtabs\main.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
1 个错误
解析代码。 (0.00s)
Java 版本号: 11
Building folders structure. (0.04s)
编译代码。 (0.01s)
编译布局文件代码。 (0.04s)
管理类库文件。 (0.04s)
(AndroidX SDK)
Compiling resources (1.75s)
Linking resources (1.51s)
编译生成的Java源码。 Error
B4A line: 62
TabLayout.SetViewPager(VP)
src\example\newviewpager\scrollingtabs\main.java:374: 错误: 无法访问ViewPager
mostCurrent._tablayout.SetViewPager((androidx.viewpager.widget.ViewPager)(mostCurrent._vp.getObject()));
^
找不到android.support.v4.view.ViewPager的类文件
注: src\example\newviewpager\scrollingtabs\main.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
1 个错误
B4X:
#Region Project Attributes
#ApplicationLabel: Scrolling Tabs example
#VersionCode: 1
#VersionName: 1.00
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#MultiDex:true
#End Region
#AdditionalJar: com.android.support:support-v4
#AdditionalJar: com.android.support:support-compat
#Extends: android.support.v7.app.AppCompatActivity
#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 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 ViewPager
Private PC As PageContainer
Private TabLayout As DSTabLayout
Private ToolBar As ACToolBarLight
Private Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout1")
'Initialize the PageContainer.
PC.Initialize
'The PageContainer is an object that holds all pages of the Viewpager.
'A page is an object of type VPage. A VPage object has a title, a tag property
'to store additional data and a Panel.
'The Panel is initialized when we add a new page to the container, but it is NOT ADDED to a layout
'at this time!
For i = 0 To 10
PC.AddPage("Page " & i)
Next
'Set the PageContainer for the ViewPager
VP.PageContainer = PC
'Set colors. The indicator color defaults to "colorAccent"
Dim ac As AppCompat
TabLayout.Color = ac.GetThemeAttribute("colorPrimary")
'Connect the TabLayout with the Viewpager. This will keep tabs and pages
'in sync and creates a nice indicator animation.
TabLayout.SetViewPager(VP)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'The current page changed.
Sub VP_PageChanged (Position As Int)
Log("PageChanged: " & Position)
End Sub
'When this event is fired, the Panel of our VPage object is added to the Layout.
'This is the time to add content to the panel.
'You can handle the content of a panel in two ways:
'1. Cached
'A cached page is only initialized once. You can check with the Page.AlreadyCreated property
'if the page was created previously.
'2. Non-Cached
'For non-cached pages you should load/create the layout every time the PageCreated event fires.
'For this method you have to remove all content from the page panel in the PageDestroyd event.
Sub VP_PageCreated (Position As Int, Page As VPage)
Log("PageCreated: " & Position)
If Page.AlreadyCreated = True Then
Log("Page already created => do nothing")
Else
Log("New Page => load the layout")
'We load a simple layout file here.
Page.Panel.LoadLayout("pagelayout")
Page.Panel.Color = Colors.RGB(Rnd(0,256), Rnd(0,256), Rnd(0,256))
Label1.Text = Page.Title
End If
End Sub
'In an Non-Cached environment remove all Views from the page Panel here to clean up everything.
Sub VP_PageDestroyed (Position As Int, Page As VPage)
Log("PageDestroyed: " & Position)
'Page.Panel.RemoveAllViews
'Page.AlreadyCreated = False
End Sub
Sub VP_PageScrolled (Position As Int, PositionOffset As Float, PositionOffsetPixels As Int)
'Log("PageScrolled: " & Position & " Offset: " & PositionOffset & " OffsetPixels: " & PositionOffsetPixels)
End Sub
Sub VP_PageScrollStateChanged (State As Int)
'Log("StateChange: " & State)
End Sub