fafaldo-zz / fabtoolbar Goto Github PK
View Code? Open in Web Editor NEWFloating Action Button transforming into toolbar
License: MIT License
Floating Action Button transforming into toolbar
License: MIT License
As we know, in the Material Design, when we click the FAB button, then the Snackbar appear and Fab button start to rise, but I find I can realize this effect by your FABToolbar.
I'm so sorry that my Chinese style English, because I'm a Chinese.
Today I discovered performance issues regarding the library (bad scrolling-performance in lists, ripple highlighting freezes etc).
Without the FABToolbar the issues are gone. I digged deeper and discovered that if I remove only the toolbarLayout
from my View-Hierarchy it works as well.
Thus I guess it has to do with toolbarLayout.getViewTreeObserver().addOnGlobalLayoutListener
which is never removed.
if layout of FloatingActionButton is
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
when we call layout.hide() then toolbar hides but FAB apears too much up. even half is cut by topbar.
It'd be great if you let the devs use their own ids for the views instead of having them hard coded.
Hi,
i'm using AppBarLayout in MainActivity
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.AppBarLayout>
and FABToolbarLayout in fragment from first tab 'Translation'.
transition animation button in the toolbar is not the same as in your example:
if i'm remove AppBarLayout and tabs, then animation getting correct.
This problem occurs when the following actions are executed:
fab.setImageResource(int res)
fabLayot.Show()
to transform the fab into toolbar.I have tested this behaviour on:
If android:background
element is set for the toolbar, then the fab's icon won't stay as background for the toolbar, but the animation issue still remains.
This issue might be related to Issue on Sony Devices with FabToolbar, but this is a problem for more than just Sony devices.
Hi,
you can use
if (Build.VERSION.SDK_INT < 16)
{
fabContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
fab.setVisibility(VISIBLE);
} else {
fabContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
fab.setVisibility(VISIBLE);
}
to make it compatible for <16 sdk versions.
Hi, thanks for this library. i have a question please answer to me ❤️
i want hide fab when isShow it, and i want write this code in onBackPress method when write this code show me error :
@Override
public void onBackPressed() {
if (fabToolbar.show()) {
fabToolbar.hide();
} else {
onBackPressed();
}
}
please help me for fix this problem. thanks my dear friend ❤️
The background color of the toolbar is not shown after switching the orientation of the device.
Trying to listen to click event on fabtoolbar_fab (FloatingActionButton) to call fabToolbar show() only when some condition is met.
Problem: My onClickListener isn't getting called when Fab is clicked.
findViewById(R.id.fabtoolbar_fab).setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
Log.d("mlog", "My Click"); // Doesn't trigger
if ( isLoaded() ) {
fabToolbar.show();
} else {
showSnackBar("Fetching newsfeed...");
}
}
});
How to change alignment of fab button to right?
Hello, when adding android:onClick="someClick"
to the ImageView
in the XML, the ripple effect disappearing after the first click.
How can this be fixed?
Hello, I have tried to set background color of "FloatingActionButton" and the animation of the layout but I can't do it! Can you please tell me how can I do that?
I placed the reveal layout in a CoordinateLayout
so it can move with AppBarLayout
but the problem is I cant anchor the floating button and Its revealing toolbar to the AppBarLayout
. Also the anchor property for the parent layout doesn't work correclty
in FABToolbarLayout.java need add check SDK version in 185 line for support Android SDK version 15:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
fabContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
fabContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
The native FloatingActionButton has elevation property, which doesn't seem to be displayed using this library
Having an issue with Sony devices in particular (Z3 & Z3 Compact) where the icon of the fab is not disappearing from the background when expanded. It doesn't happen on a Galaxy Nexus running JellyBean or Nexus 5 running Marshmallow. The video below demonstrates the issue...
http://clients.intohand.com/demo/XperiaProblem.mov
Could you please add an example app or more java code to implement the FABToolbar layouts??
i am totally new to this and this looks like a pretty awesome library, it will be really helpful.. @fafaldo
When I click on FAB and toolbar options visible then , toolbar options should hide when I scroll down and visible when scroll up.
I can't set anchor in CoordinateLayout
so the floating action button and it's toolbar stick to the bottom of the AppBarLayout
Hi,
I set FAB that morphs into android.support.v7.widget.Toolbar:
<com.github.fafaldo.fabtoolbar.widget.FABToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fabtoolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:containerId="@+id/fabtoolbar_container"
app:fabId="@+id/fabtoolbar_fab"
app:fabToolbarId="@+id/fabtoolbar_toolbar"
app:fadeInFraction="0.2"
app:hideDuration="200"
app:horizontalMargin="30dp"
app:showDuration="600"
app:verticalMargin="30dp"
tools:showIn="@layout/activity_main">
<RelativeLayout
android:id="@+id/fabtoolbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:clipChildren="false"
android:clipToPadding="false">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabtoolbar_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_mode_edit_white_24dp"
app:fabSize="mini" />
</RelativeLayout>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fabtoolbar_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize"
app:theme="@style/Base.Theme.AppCompat.CompactMenu">
<Spinner
android:id="@+id/add_spinner"
android:layout_width="50dp"
android:layout_height="match_parent" />
<!--android:background="@android:drawable/btn_default"-->
</android.support.v7.widget.Toolbar>
</com.github.fafaldo.fabtoolbar.widget.FABToolbarLayout>
I have two issues:
The cause for this is 50dp size of the spinner. If I set it to 70dp everything works fine.
I want to do the same example showed on Material Design doc (on scroll transform the Toolbar on Float Button). I tried to do this with this lib but when I start the Activity with fABToolbarLayout.show() (after the Activity render the screen) the lib do the expand animation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.