android-design-library

Show/Hide FloatingActionButton on ViewPager swipe

笑着哭i 提交于 2019-12-03 17:42:17
问题 I have an activity that has 3 tabs. Each tabs page is a fragment which displays a RecyclerView. One of the fragment has FloatingActionButton in it. I'm implementing this Button in the Fragment's layout. I'm also making it static at the bottom right of the Fragment. Fragment layout: - CoordinatorLayout - RecyclerView - FAB (without any behavior) In Activity layout, I have: - CoordinatorLayout - AppBarLayout - Toolbar - TabLayout (SmartTabLayout) - ViewPager The problem now is the FAB is half

Toolbar not showing with swipe to refresh

牧云@^-^@ 提交于 2019-12-03 16:55:54
问题 I'm trying to implement collapsing tollbar with swipe to refresh and recyclerview. When I'm trying to scroll (when recyclerview has only one item) toolbar collapse, but when I'm trying to scroll down to show toolbar, it's impossible because swipe down causes swipe to refresh. When recyclerview has more item it works perfectly. Link to gif with problem <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android

How to use Android AppBarLayout, Toolbar and TabLayout with fragments

允我心安 提交于 2019-12-03 16:37:38
I have activity with NavigationDrawer and AppBarLayout with Toolbar. Unfortunately when I am using TabLayout in child fragment I see shadow between toolbar and TabLayout. Is it possible display shadow below TabLayout only? I do not want to move TabLayout to my activity because I'm using it only in one fragment. I can see few solutions for this problem: disable elevation on Toolbar & TabLaout ( don't like it) remove toolbar from activity and move it into fragment Do you have any ideas how to use it properly in my scenario? I had the same issue and it is easy to fix. Just remove the AppBarLayout

How to show unread notification counter on Tabs inside TabLayout?

浪子不回头ぞ 提交于 2019-12-03 15:26:15
I am using TabLayout of android support design library. I want to show unread notification counter on the tab with title like below image. How to set unread count on Tab inside TabLayout ? Use public TabLayout.Tab setCustomView (int layoutResId) Create a Layout with TextView and Button use this in Custom view. For reference setCustomView Example Hope this will helpful to you. Take a look at android-viewbadger ... 来源: https://stackoverflow.com/questions/32269517/how-to-show-unread-notification-counter-on-tabs-inside-tablayout

Android TabLayout does not display contents anymore as soon as fragment is switched

为君一笑 提交于 2019-12-03 12:22:32
I am using a navigation drawer in my project, with 5 fragments in it. In one fragment I have the in the design support library introduced TabLayout, which includes 2 Fragments. All works fine, except when I leave the fragment which has the TabLayout and switch back to it, all the content is gone. In each fragment in the TabLayout I have a SwipeRefreshLayout with a ListView in it, they both don't display anything upon switch. I also noticed the TabLayout starts acting strange. by strange I mean the white indicator starts jumping, you are able to hold it still in the middle of the two tab... So

FloatingActionButton setVisibility() not working

五迷三道 提交于 2019-12-03 11:09:49
I can't hide my FloatingActionButton . Here is my code: XML: <CoordinatorLayout> <AppBarLayout android:id="@+id/appbar"> <CollapsingToolbarLayout> <ImageView/> <android.support.v7.widget.Toolbar /> </CollapsingToolbarLayout> </AppBarLayout> <NestedScrollView /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" app:layout_anchor="@id/appbar" app:layout_anchorGravity="bottom|right|end"/> </CoordinatorLayout> And I'm calling: fab.clearAnimation(); fab.setVisibility(View.GONE); I'm trying to hide the FAB, but it seems that setVisibility + clearAnimation does not work if the

How I can multiline the expanded title of CollapsingToolbarLayout?

*爱你&永不变心* 提交于 2019-12-03 10:45:40
问题 My problem is the next. I would use relatively large texts as CollapsingToolbarLayout title so I need to show it as multiline mode. When I try to change text appearance through the setExpandedTitleTextAppearance() method it doesn't work. The code who I used is the next: <style name="ToolbarExpandedTitle"> <item name="android:textSize">48sp</item> <item name="android:shadowColor">#ffffff</item> <item name="android:textColor">@android:color/white</item> <item name="android:singleLine">false<

Material Design: Add circular reveal animation while switching between toolbars

走远了吗. 提交于 2019-12-03 08:56:19
I was reading the "Selection" section in material design guidelines ( https://material.io/guidelines/patterns/selection.html ), and one effect i wanted to add in my app was the circular reveal animation while switching between the app bar and the ActionMode ? An other toolbar ? Here is an example from the guidelines: https://storage.googleapis.com/material-design/publish/material_v_10/assets/0Bwp7jtSjaW36RGF3eUFsRkdqU1U/patterns_selection_item_controlling_desktop_click.webm I didn't found any explanations about how to do that. I do not even know if they use an ActionMode or something else...

CoordinatorLayout children are not fullscreen

↘锁芯ラ 提交于 2019-12-03 08:12:51
I have an Activity which is displayed fullscreen. This works perfectly with many layouts I have tried, except for when the CoordinatorLayout is the root ViewGroup . The CoordinatorLayout itself has both width and height set to match_parent and it takes the whole screen as it should. But the child views that should have the same size as the CoordinatorLayout are laid as if the navigation bar was still visible. Is there a way to make the child views resize with the CoordinatorLayout ? Obviously fitSystemWindows does not change a thing as this is probably caused by the CoordinatorLayout

Icons in TabLayout

纵然是瞬间 提交于 2019-12-03 08:07:31
I have a simple AppCompatActivity with one simple Toolbar (android.support.v7.widget.Toolbar), one Design-Library TabLayout and one ViewPager . Now I have in this case 4 fragments which are inside the viewpager and can be swiped from the sides. That works fine. But as soon as I use mTabLayout.setupWithViewPager(mViewPager); , the icons disappear but I can tab on the empty spaces which works fine. If I remove the line, the icons are visible again, the "swipe" works but if I tab to an icon, nothing happens. My Code MainActivity public class MainActivity extends AppCompatActivity { private