B4A Library BottomNavigation

tuhatinhvn

Active Member
Licensed User
Longtime User
how to set height and change icon??

your library are always very little information and very hard to use!
 

DonManfred

Expert
Licensed User
Longtime User

Mashiane

Expert
Licensed User
Longtime User
I have played around with this, here is another example.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    ' this is the color of a selected item when isColoredBackground(False)
    Navigation.ItemActiveColorWithoutColoredBackground = Colors.Magenta
    ' background color of navigation bar
    Navigation.Color = Colors.green
    ' when an item is clicked, does the color change? True = Yes
    Navigation.isColoredBackground(True)
   
    AddNavigationItem("10K", Colors.Blue, "likeb")
    AddNavigationItem("2K", Colors.Red, "comment")
    AddNavigationItem("Following", Colors.Yellow, "following")
End Sub

' define a single method to add an item
Sub AddNavigationItem(sTitle As String, clr As Int, res As String)
    ' the color here works when the isColoredBackground(true)
    ' when clicked, the color of the whole BottomNavigation turns into that
    Dim Item As BottomNavigationItem
    Item.Initialize(sTitle,clr,res)
    Navigation.addTab(Item)
End Sub
 

Attachments

  • BottomNavigationExample.zip
    16.8 KB · Views: 394

billyrudi

Active Member
Licensed User
Longtime User
Hi, there is a way to rise every bottom click the onNavigationItemClick event? even though i already clicked it?

regards Paolo
 

fredo

Well-Known Member
Licensed User
Longtime User

It seems the author updated the lib and there are some new important features.
  • disableShadow
  • setItemActiveColorWithoutColoredBackground
  • setTextActiveSize
  • setTextInactiveSize
  • setFont
  • willNotRecreate
  • setUpWithViewPager
  • selectTab
  • disableViewPagerSlide

@DonManfred would it be possible that you update the wrap?

(I tried to make a wrap with SLC by myself but I always get the error:
BottomNavigationView.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
and I don't know how to fix it.)
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
would it be possible that you update the wrap?
See Post #1

I´ve updated the lib to V1.1 using the newest github source...
I added a second sample to show the use of the ahviewpager... It is not using the color and imageresource arrays btw...
 

BarryW

Active Member
Licensed User
Longtime User
i get an error

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 336)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.example.BottomNavigation.main._activity_create(main.java:336)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.BottomNavigation.main.afterFirstLayout(main.java:102)
at b4a.example.BottomNavigation.main.access$000(main.java:17)
at b4a.example.BottomNavigation.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 17 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1166)
at android.content.res.Resources.getDimension(Resources.java:552)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:35)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:87)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:83)
at de.donmanfred.BottomNavigationViewWrapper._initialize(BottomNavigationViewWrapper.java:72)
... 21 more
 

MarcoRome

Expert
Licensed User
Longtime User
I


i alreader add those things
This happen with library 1.1 ( Don also me have this error with Rel.1.1 )
If you try with library 1.0 work and try both example ( ButtonNavigationEx or ButtonNabvigationExViewPage ) will work without problem
 

MarcoRome

Expert
Licensed User
Longtime User
This happen with library 1.1 ( Don also me have this error with Rel.1.1 )
If you try with library 1.0 work and try both example ( ButtonNavigationEx or ButtonNabvigationExViewPage ) will work without problem

Maybe Don have forget "new" folder Resource for Rel.1.1 ( in 2 example ButtonNabvigationExViewPage dont exist this folder and in first example ButtonNavigationEx is relative library 1.0 )
 

JNG

Member
Licensed User
Will it be possible to use IconFonts in the navigation bar e.g.
FontAwesome / Material Icons ? if yes pl. help how.?

regards
jng
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…