android-design-library

Android NestedScrollView has wrong size after app:layout_behavior

ぐ巨炮叔叔 提交于 2019-11-28 17:17:27
Since Google has published the design support library for android, there are many nice things that can be done without implementing custom code. While i've tested the custom views in this lib, i have found a worse thing, and i didn't know if this is a bug or not. I have found the cheesesquare project on github. In the activity_detail.xml(layout file) there are 3 CardViews inside the NestedScrollView. If you delete 2 of them, you can see that the NestedScrollView doesn't have the full size of the parent(match_parent). The NestedScrollView is bound to the bottom of the parent view. http://i

Dynamically add and remove tabs in TabLayout(material design) android

不问归期 提交于 2019-11-28 17:12:36
I have a TabLayout and inside that I have ViewPager. I need to dynamically add and remove tab in tablayout(material design). I can able to add the tabs dynamically but while removing the tab, tab is removing correctly. But viewpager last item is deleted. So tab is not showing specific fragment. FYI i have used FragmentPagerAdapter. I have followed this tutorial to implement this https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library public class TabFragment extends Fragment { public static TabLayout tabLayout; public static ViewPager viewPager; public static

TabLayout tab style

↘锁芯ラ 提交于 2019-11-28 17:10:10
I use new TabLayout from com.android.support:design library. I want to change background of the selected/unselected tabs. I look at sources and found only tabBackground attribute that change all tabs colour and does not control selected tab colour. How can I control selected/unselected tab background? Akshay Define: <style name="AppTabLayout" parent="Widget.Design.TabLayout"> <item name="tabMaxWidth">@dimen/tab_max_width</item> <item name="tabIndicatorColor">?attr/colorAccent</item> <item name="tabIndicatorHeight">4dp</item> <item name="tabPaddingStart">6dp</item> <item name="tabPaddingEnd"

What is CoordinatorLayout?

北慕城南 提交于 2019-11-28 16:36:33
Just had a look at the demo app of new Android support design library. It's provided by Chris Banes on github . Throught the app, CoordinatorLayout is used Heavily. Also, many of the support design library classes such as FloatingActionButton , SnackBar , AppBarLayout etc. behaves differently when used inside CoordinatorLayout . Can someone please shed some lights on what is CoordinatorLayout and how it is different from other ViewGroup s in android, or at least provide correct path towards learning CoordinatorLayout . Here it is you are looking for. from docs the Design library introduces

How to animate FloatingActionButton like in Google+ app for Android?

夙愿已清 提交于 2019-11-28 16:22:07
问题 I set FloatingActionButton to bottom of screen and I want to animate the button. Hidden when scrolling down Shown when scrolling up Like google implemented it in their Google+ app. I think CoordinatorLayout and AppBarLayout is needed but how to implement it to use it with the FloatingActionButton? 回答1: You can achieve it using the default FloatingActionButton changing its default Behavior using the app:layout_behavior attribute: You can use a layout like: <android.support.design.widget

How to disable scrolling of NestedScrollView&CollapsingToolbarLayout, for example when there is no more content below?

青春壹個敷衍的年華 提交于 2019-11-28 15:38:24
Background I try to add the same functionality as shown on many apps, where the upper area of the screen shrinks&expands according to the scrolled content. For this, I use Google's design library, as shown on the CheeseSquare sample . The problem Thing is, no matter how much content there is in the NestedScrollView , it lets me scroll way below the last view of the content, just to let me see the final state of the actionbar, having the minimal size of itself. In short, this is what I see when scrolling to the bottom (modified content of CheeseSquare sample): while this is what I'd like to

Android CollapsingToolbarLayout collapse Listener

梦想的初衷 提交于 2019-11-28 15:27:05
I am using CollapsingToolBarLayout alongside with AppBarLayout and CoordinatorLayout , and they are working Fine altogether. I set my Toolbar to be fixed when I scroll up, I want to know if there is a way to change the title text of the Toolbar, when CollapsingToolBarLayout it is collapsed. Wrapping up, I want two different titles when scrolled and when expanded . Thank you all in advance I share the full implementation, based on @Frodio Beggins and @Nifhel code: public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener { public enum State { EXPANDED,

Unable to use drawable in EditText inside TextInputLayout

て烟熏妆下的殇ゞ 提交于 2019-11-28 14:24:34
I recently upgraded Android Design library from 24.2.1 to 25.0.0. After this the "drawableX" feature in EditText doesn't work. EDIT 01.11: I learned that setting drawable in xml works if you use android:drawableStart instead of android:drawableLeft. But setting setting drawables programatically does not work. I use this to make a "Clear"-button to empty the EditText. But this feature is broken now. I would appreciate any work-arounds or knowledge about if this is intentional from Google or a bug! My code for Clearable edit-text that worked before but doesn't now: public class

Could not initialize class android.support.design.widget.CoordinatorLayout

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 11:54:51
I am trying to use the CoordinatorLayout from the new Android design library. I added the package to gradle; then I try to use the layout I get this error: java.lang.NoClassDefFoundError: Could not initialize class android.support.design.widget.CoordinatorLayout at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java

FloatingActionButton, square button below API level 17

我只是一个虾纸丫 提交于 2019-11-28 11:17:52
I am using android.support.design.widget.FloatingActionButton from the new Design Support library 22.2.0, in my layout file. It is working fine but it shows a square button below API level 17 This is known by Google and will be fix soon in the next version of the Design Support Library, see this issue: FAB Appears as a square on API 16 . It should only concern API 16. The workaround, proposed in the same thread, is to add app:borderWidth="0dp" to your FAB. Finally the issue has been fixed in the new release compile 'com.android.support:design:22.2.1' this will solve the square layout issue in