android-design-library

How can I get menu item in NavigationView?

半世苍凉 提交于 2019-12-04 08:48:26
问题 <android.support.design.widget.NavigationView android:id="@+id/drawer_nav" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:theme="@style/Theme.AppCompat.Light.NoActionBar" app:headerLayout="@layout/drawer_header" app:menu="@menu/menu_drawer" /> I am using android.support.design.library for material design. What I want is to hide some menu items when the user is not logged-in. Now I have trouble to get the menu item in

FrameLayout Shown Above AppBarLayout

断了今生、忘了曾经 提交于 2019-12-04 07:30:01
I have a simple CoordinatorLayout with a AppBarLayout and FrameLayout , but the FrameLayout contents are being displayed over the AppBarLayout regardless of the layout_behavior attribute on the FrameLayout . I've tried adding that attribute elsewhere (like on my RecyclerView ), but it's the same behavior. Here's a picture to show what I mean. Activitiy Layout: <?xml version="1.0" encoding="utf-8"?> <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"

Snackbar with API 21

↘锁芯ラ 提交于 2019-12-04 05:46:17
I'm trying to implement the new Snackbars in my app but I can't. First of all I downloaded the zip file from this SnackBarSampleActivity . I unziped it and then I import it in Eclipse. Now I get an error retrieving parent... for the theme parent in styles.xml . I change it to android:Theme.Light and the error was gone. I right clicked the project and checked isLibrary in Properties/Android, I right clicked my app and in Properties/Android I add the library. Finally I paste the code to show a Snackbar but I get an error because Snackbar cannot be resolved . Please somebody help me! I'm going

(Collapsing)Toolbar title resets its position after Snackbar appearance

ε祈祈猫儿з 提交于 2019-12-04 05:43:37
I have a layout with CollapsingToolbarLayout and CoordinatorLayout as root element. Whenever a Snackbar is shown in the activity the title of the toolbar resets its position to the default expanded title position of the CollapsingToolbar even if the toolbar is not (fully) expanded. The second picture shows that the title is fixed no matter if the toolbar expands or not. The result is the same when I call snackbar.show() in activity or fragment . My layout structure looks like this: <CoordinatorLayout> <AppBarLayout> <CollapsingToolbarLayout> <Toolbar /> <TabLayout /> </CollapsingToolbarLayout>

Floating Action Menu implementation using Float action button from Android Design Support library [closed]

牧云@^-^@ 提交于 2019-12-04 05:02:08
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Is there any simple implementation of Floating Action Menu using Floating Action Button from Android Design Support Library ? I Found one here: https://github.com/chrisbanes/cheesesquare Hope it helps :) 来源: https://stackoverflow.com/questions/30523144/floating-action-menu-implementation-using-float-action-button-from-android-desig

TextInputLayout hint color in error state

泄露秘密 提交于 2019-12-04 02:19:30
As per Googles Material Guidelines: https://material.io/guidelines/components/text-fields.html#text-fields-layout TextInputLayout hint should be the same color as the Error message: However it is not like that and when I call setError("My error") only the underline and the error message show up in red. How can I change this behavior to account for Google's own guidelines? here is how you can do it <android.support.design.widget.TextInputLayout android:padding="8dp" android:id="@+id/tilSample" app:errorTextAppearance="@style/error_appearance" app:hintTextAppearance="@style/error_appearance"

Bug with anchored FloatingActionButton in support library 24.2.1

吃可爱长大的小学妹 提交于 2019-12-04 00:56:09
I have been having this issue since 24.2.0, but now I'm using 24.2.1 and the bug is still here, it only works well <= 24.1.1. I have an anchored FloatingActionButton done like this: <ScrollView 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:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.CoordinatorLayout android:id="@+id/contact_coordinator_layout" android:layout_width="match_parent" android:layout_height="wrap_content" tools

Snackbar action text color not changing

落花浮王杯 提交于 2019-12-03 22:04:20
I want to change the action text color for my snackbar, but it is not working for some reason. I use the following code to display a snackbar: Snackbar.make(findViewById(R.id.root), "text", Snackbar.LENGTH_LONG).setActionTextColor(R.color.yellow).setAction("OK", new View.OnClickListener() { @Override public void onClick(View view) { } }).show(); The argument of setActionTextColor is the int that represents the color, not the resource ID. Instead of this: .setActionTextColor(R.color.yellow) try: .setActionTextColor(Color.YELLOW) If you want to use resources anyway, try: .setActionTextColor

AppBarLayout child doesn't collapse when scrolling

冷暖自知 提交于 2019-12-03 21:11:52
I have a AppBarLayout which contains an horizontal RecyclerView among its children. The sibling of the AppBarLayout is a ViewPager (which contains a vertical RecyclerView ). Here is the XML: <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLayout" 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:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ui.search.SearchResultFragment"> <android.support.v4.view.ViewPager android

How to use setDuration() method in SnackBar (Android Design Support Library)

社会主义新天地 提交于 2019-12-03 18:29:54
问题 From Documentation: parameter duration - either be one of the predefined lengths: LENGTH_SHORT, LENGTH_LONG, or a custom duration in milliseconds . But I can't set custom duration. For example Snackbar .make(parentLayout, "Feed cat?", 8000) // try here .setAction("Yes", snackOnClickListener) .setActionTextColor(Color.MAGENTA) .setDuration(8000) // try here .show(); but instead of 8 seconds Snackbar gone quickly. 回答1: Based on the implementation of Snackbar and SnackbarManager , I can confirm