Comments (10)
@skimarxall
Alright, fair points.
I'm making it usable by XML and I'll provide instructions how to use it in the Readme.
from bottombar.
I agree, as it's a UI library, it should be added via the layout. Maybe you can refer to how works NagvationView and use menu xml to populate the Bottombar for example?
from bottombar.
@skimarxall
Good points.
- The creation dynamically by Java code was to simplify the use. I found it a bit awkward to use it directly by xml, as you would have to use a FrameLayout with two children (your main content and BottomBar with
android:layout_gravity="bottom"
set) to get started. I'll look into using it by XML though, as it's been requested multiple times. - I think it's kind of a matter of taste issue, but don't worry: I won't implement completely irrelevant things. I just think that handling Fragments automatically is convenient.
3 & 4. Will do.
from bottombar.
@HugoGresse
A NavigationView is just a FrameLayout and as far as I can tell, doesn't do much regarding it's position on screen. It's usually wrapped in a DrawerLayout which handles putting the NavigationView to the right place.
from bottombar.
yes right ! java should be used only to override xml attributes
from bottombar.
@roughike I think the position of the bar should be a job of the dev. I know it's nice to have everything out of the box, but normally this leads to workarounds to fix some special cases.
Take a look at this gist https://gist.github.com/NikolaDespotoski/1d6fef4949eb9be05a46
He is using the support TabLayout wrapped in a LinearLayout as a BottomNavigation. I think you BottomBar should replace that. So a normal view will look like
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/long_text"/>
</android.support.v4.widget.NestedScrollView>
<com.roughike.bottombar.BottomBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:tabMenu="@menu/bottom_menu"
app:layout_behavior="@string/bottom_navigation_behavior"
app:tabLayoutId="@+id/tabs"/>
</android.support.design.widget.CoordinatorLayout>
Maybe you could even avoid the width and height and force it on the creation of your view. But I am not sure about that.
from bottombar.
@skimarxall
I forgot to mention the other problem with xml inflation. In your example, the NestedScrollView wouldn't know anything about the BottomBar (and vice versa), so the BottomBar would overlap content, because the NestedScrollView would be partially under it.
from bottombar.
@roughike that's how it has to be. This is the behaviour defined by the specs. When you scroll the bottom navigation should go away. thus the scroll content should get the full size. Is the dev that needs to let enough padding or spacing at the end in order to avoid content overlapping.
Or you use a RelativeLayout and the nested scroll view defines layout_above="@+id/bottom_bar"
That's is what I actually meant with being flexible, is the dev job to decide this kind of behavior.
from bottombar.
Here's some solutions for your issues:
- No XML (see below why), but by using
bottomBar.attach(findViewById(R.id.myView), savedInstanceState)
will let you control what View the BottomBar should contain. Basically with this you can put it anywhere in the View hierarchy. - Not really an issue, and lots of people are already using it (including myself) so no reason for removing this feature.
- & 4. These are both now supported.
Here's what I found about the XML issue:
- A bit awkward to use it directly by xml, as you would have to use a RelativeLayout with two children, your main content with
android:layout_above="@+id/bottomBar"
and BottomBar withandroid:layout_alignParentBottom="true"
set to get started. - Even after that it won't behave properly on tablets without extra configuration from the user (an extra layout in layout-sw600dp folder). It should look like this but the BottomBar has no way to not overlap content.
Using the BottomBar should be as simple as possible and same code should work by default for both tablets and phones solution.
For these reasons, I'm closing this issue.
I really appreciate your feedback though! Feel free to create new issues if something new comes to your mind.
from bottombar.
@roughike how would you then use it with coordinator layout if its not on the xml?
At the end is a library decision if you want to give it as xml or java. I think since it's a view it makes more sense to use it as xml even if then it requires some extra configuration.
Glad that you implement the other two points though.
from bottombar.
Related Issues (20)
- Not support set badge count in text format HOT 3
- Bump to version 26 HOT 1
- bottom bar not working on first time
- Change The BottomBar selected with Swipe Gesture
- How to change the icon in the code?
- Does it support changing the title color only? HOT 1
- How can I change the color of bottom bar item title , without affecting the bottom bar icon ?
- How do I remove the shadow of the click HOT 1
- Call Fragment onTabSelect
- "iconsOnly" doesn't center the icon in the view container
- BottomBar crashes when "minSdkVersion" is set to 21 HOT 1
- BottomBarBadge is not accessible.
- Crash: NullPointerException
- Vector image
- disable first tab autoselection HOT 2
- Programmatically activate tab without firing events
- Shy behaviour is not working
- open third tab onstart HOT 3
- Will this library support in SDK level 30 ?
- 可否实现选中一个图片,未选中一个图片 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bottombar.