androiddesignsupport

NavigationView menu items with counter on the right

亡梦爱人 提交于 2019-12-17 05:40:20
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

NavigationView menu items with counter on the right

不问归期 提交于 2019-12-17 05:40:06
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

Why do I get an extra 50 pixels of vscrolling on my AppBarLayout with scroll|enterAlways?

前提是你 提交于 2019-12-13 01:00:31
问题 I have the following layout (almost the same as the scrollingActivity generated by Android Studio ) Notice the layout_height s and layout_scrollFlags <?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows=

Android switch Fragments in the new design support navigation drawer

无人久伴 提交于 2019-12-12 06:12:53
问题 how can I switch Fragments in the new design support navigation drawer? I found example codes on the Cheesesquare Github on how to switch fragments using the TabLayout, but not the navigation drawer. Is that the same? I also would not like to recreate fragments when switching, but rather do it like the TabLayout where it retains the fragments instance and the fragment`s content is how the user left it. 回答1: Write some code like this: navigationView.setNavigationItemSelectedListener( new

How do I implement AppCompatActivity with NavigationDrawer and multiple fragments reusing same TabLayout?

心不动则不痛 提交于 2019-12-12 05:14:52
问题 I have successfully used TabLayout with AppCompatActivity with a CoordinatorLayout that looks close to this snippet: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:fab="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height

Error inflating class NavigationView from XML

和自甴很熟 提交于 2019-12-12 02:27:59
问题 I'm using NavigationView in my MainActivity. Now, My App runs fine in Android 5.0 and above. but, It doesn't run in Android 4.0.4 . It shows me XML error in <NavigationView /> . I've than added multidex support by thinking it should help. but, it didn't. Currently I've 4 icon in NavigationView & 1 launcher icon in header_layout . so, I don't think it should OutOfMemoryError . Here's My Code build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion

Gone FAB becames visible for a while

老子叫甜甜 提交于 2019-12-11 12:34:09
问题 I have FAB from Design Support Library in my 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android

How to animate the hamburger icon to back arrow while using design support library?

空扰寡人 提交于 2019-12-11 09:47:28
问题 Hello I am using the most recent support library from android called design support library and using the NavigationView in it for shwing drawer. But the problem is when I am openning my drawer my hamburger icon doesnt spins into a back arrow icon, it always remains the same, but I can remember that when I used the drawerlayout without the support library it spinned automatically, here is my last try that I did: dl.setDrawerListener(new ActionBarDrawerToggle(this, dl, tb, R.string.navigation

How to dim background when using the BottomSheet from the support library?

送分小仙女□ 提交于 2019-12-09 16:38:00
问题 How can the background be dimmed just like it is shown here? I've set it up normally using the CoordinatorLayout and the BottomSheetBehavior . 回答1: This will simply show a bottom sheet. public class MyBottomSheet extends BottomSheetDialogFragment { private static final String TAG = "MyBottomSheet"; @NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); final View view =

Bug with anchored FloatingActionButton in support library 24.2.1

核能气质少年 提交于 2019-12-09 14:32:51
问题 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