android-design-library

Show/Hide FloatingActionButton on ViewPager swipe

一曲冷凌霜 提交于 2019-12-03 06:24:43
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-hidden from the view when Toolbar is expanded, but fully shown when Toolbar is collapsed. Though this

Switch in Navigation drawer item with Design Support Library on Android

十年热恋 提交于 2019-12-03 06:12:59
I need to put Switch inside item in navigation drawer. I'm using new design support library, but I cannot find if it is posibble at all. When using android:checkable item is just full selected and that is not what I wish. This is screenshot of what I really want. Is that possible to achieve that? Your menu item for the navigation drawer: <item android:id="@+id/nav_item1" android:icon="@drawable/ic_item1" android:title="item1" app:actionLayout="@layout/layout_switch" /> and the layout for that item: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com

TextInputLayout hint color

白昼怎懂夜的黑 提交于 2019-12-03 05:28:41
I'm using new Google design library (com.android.support:design:22.2.0) and I have problem with android.support.design.widget.TextInputLayout . If I set its EditText programmatically, floating hint color is gray instead of accent color. It works if user fills field (EditText) itself or if he changes preddefined value of field. This is my code: <android.support.design.widget.TextInputLayout android:layout_height="wrap_content" android:layout_width="match_parent"> <EditText android:id="@+id/register_username" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="

How to handle issues of the new bottom sheet of the support/design library?

ぃ、小莉子 提交于 2019-12-03 05:13:41
问题 Background I've used a modified version of bottom-sheet library (here, based on this library, also wrote about it here), in order to have a nice transition between collapsed (AKA "peeked") state and expanded state. The library had its issues, but in general I've fixed them all. The problem Recently we've found that after going back from all ad-networks screens, back to one that has a bottom sheet, the bottom sheet gets into a weird state of being expanded. I've decided that it's time to try

WebView in CoordinatorLayout with CollapsingToolbarLayout

狂风中的少年 提交于 2019-12-03 04:53:53
问题 I'd like to add a WebView in a CoordinatorLayout, having CollapsingToolbarLayout in AppBarLayout. The problem is that WebView shrinks in height and doesn't fill the space below the toolbar, making it not usable. I tried also to use WebView as child of NestedScrollView: initially it doesn't work (it shrinks my WebView in height), but scrolling my shrinked WebView makes it fill viewport. Here is the layout I used: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget

TabLayout update tab content with a custom view

眉间皱痕 提交于 2019-12-03 04:50:16
问题 I'm using TabLayout of the new material design and i have a problem, i can't update tab content of a custom view once the tab is created: I can simplify my method inside my PagerAdapter with public View setTabView(int position, boolean selected) { View v = LayoutInflater.from(context).inflate(R.layout.default_tab_view, null); tv = (TextView) v.findViewById(R.id.tabTextView); if(selected) tv.setText("SELECTED"); else tv.setText("UNSELECTED"); return v; } And in activity i can simplify my code

CollapsingToolbarLayout ImageView is not scrollable

元气小坏坏 提交于 2019-12-03 04:16:40
Using cheesesquare - android support library example is it possible to make the Header ImageView scroll-able? <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="@dimen/detail_backdrop_height" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:fitsSystemWindows="true"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed" android

How to create app bar with icons using TabLayout Android Design?

筅森魡賤 提交于 2019-12-03 03:49:34
问题 I'm trying to use the new TabLayout in the android design library to create app bar with icons. public void setupTabLayout(TabLayout tabLayout) { tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); tabLayout.setupWithViewPager(mViewpager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_tabbar_library); tabLayout.getTabAt(1).setIcon(R.drawable.ic_tabbar_recents); tabLayout.getTabAt(2).setIcon(R.drawable.ic_tabbar_favorites); tabLayout.getTabAt(3)

Tab with icon using TabLayout in Android Design Library

房东的猫 提交于 2019-12-03 03:38:20
I'm trying to use the new TabLayout in the android design library to create app bar with icons only. like this: how can I do it using the new TabLayout Android Design Library. is there a simple solution for this, or i have to use the setCustomView only. i'm trying to avoid using it. because i didn't get the tint color for the icon like this image above. i try to write like this: tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.ic_dashboard)) but the icon still stay in the same color when i select the tab you have to create a selector for the icon. For example: <?xml version="1.0"

how to set unread notification count in NavigationView of DrawerLayout?

爷,独闯天下 提交于 2019-12-03 02:46:42
问题 I have created one NavigationView inside DrawerLayout using Android Design Support Library <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- other views --> <android.support.design.widget.NavigationView android:id="@+id/navigation" android:layout_width