android-design-library

Design support library - Which version to use with SDK v21

只谈情不闲聊 提交于 2019-11-27 04:25:25
问题 I have problems to understand the version scheme of the support libraries and when to use which version. Currently I have a project with compileSdkVersion 21 , minSdkVersion 21 and targetSdkVersion 21 and want to use the android design support library. When I use com.android.support:design:22.2.0 the project compiles but I get a Gradle warning: "This support library should not use a different version (22) than the `compileSdkVersion` (21)". When I use com.android.support:design:23.0.1 I get

Android Multiline Snackbar

时光怂恿深爱的人放手 提交于 2019-11-27 04:17:10
问题 I'm trying to leverage new Snackbar from Android Design Support Library to display multiline snackbar, as shown in http://www.google.com/design/spec/components/snackbars-toasts.html#snackbars-toasts-specs: import android.support.design.widget.Snackbar; final String snack = "First line\nSecond line\nThird line"; Snackbar.make(mView, snack, Snackbar.LENGTH_LONG).show(); It displays only First line... on my Nexus 7. How to make it display all lines? PS: I tried Toast and it displayed all lines.

How to reset the Toolbar position controlled by the CoordinatorLayout?

我们两清 提交于 2019-11-27 04:14:06
问题 The app I'm working on consists of a Navigation Drawer which is implemented in an Activity. The activity layout is as follows: <FrameLayout 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.DrawerLayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout

CollapsingToolbarLayout setTitle() does not update unless collapsed

北城余情 提交于 2019-11-27 04:00:12
问题 With the new Design Library, we're supposed to set the toolbar title on the CollapsingToolbarLayout , not the Toolbar itself(at least when using the collapsing toolbar). But setTitle() only updates the title in the following specific circumstances: 1) When the CollapsingToolbarLayout does not have a title yet 2) At the moment the CollapsingToolbarLayout becomes fully collapsed 3) At the moment the CollapsingToolbarLayout starts to expand What I'm actually trying to do is make the title become

Error when using any Android Design Support Library Elements

妖精的绣舞 提交于 2019-11-27 03:56:42
Error inflating anything from the design support library xml <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content"/> build.gradle dependencies { compile 'com.android.support:support-v4:22.2.0' compile 'com.android.support:design:22.2.0' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:support-v13:22.2.0' compile 'com.android.support:appcompat-v7:22.2.0' project build.gradle buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } allprojects {

Set starting height of CollapsingToolbarLayout

扶醉桌前 提交于 2019-11-27 03:31:51
I want to be able to scroll on the ImageView inside the CollapsingToolbarLayout. So how that would be possible, and How to set a starting height of that Image view? My ImageView height is 280p, at the start of the activity I want to show 200p and then I can scroll down to see the rest of the Image. I have seen something similar in WhatsApp application. Here is a link to see what I want : My code : <?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 TabLayout Android Design

夙愿已清 提交于 2019-11-27 02:52:51
I'm trying to get the new TabLayout in the android design library working. I'm following this post: http://android-developers.blogspot.com/2015/05/android-design-support-library.html and the documentation: http://developer.android.com/reference/android/support/design/widget/TabLayout.html And have come up with the following code in my activity but the tablayout isn't showing up when I run the activity. I tried adding in the activity layout file, but it says it can't find that xml tag. public class TabActivity extends BaseActivity { SectionPagerAdapter mSectionsPagerAdapter; ViewPager

How to set custom typeface to items in NavigationView?

我是研究僧i 提交于 2019-11-27 02:38:12
With the new NavigationView , we are able to set a drawer's items through a menu resource in XML. With that, we can set each item with something like <item android:id="@+id/drawer_my_account" android:icon="@drawable/ic_my_account" android:title="@string/drawer_my_account" /> But now, I want to set a custom typeface to each of those items in my drawer, and I could not find a way to do that, either by XML or by Java code. Is there a way to do it? just add following class file to your project. import android.graphics.Paint; import android.graphics.Typeface; import android.text.TextPaint; import

Customising NavigationView - Adding dynamic headerView, Android Support Design Library

半城伤御伤魂 提交于 2019-11-27 02:35:49
问题 I tried the navigationView from the new android support design library. I want to have a dynamic headerview. Basically, my headerview will show something like quote of the day. I have like around 10 quotes and i want to randomly select a quote and display in a textview in the headerView. I also want to add onClick method for the headerView. Right now, I don't see any possibilities of changing the headerview layout programmatically. Any suggestions to implement this? 回答1: first create header

ListView nested scrolling on API<21

假装没事ソ 提交于 2019-11-26 23:28:34
问题 Title is clear. I'm having this layout: _________________ |_______________| <- Toolbar |___|___|___|___| <- Tablayout | | | | | ViewPager | | | |_______________| Both toolbar and tablayout are inside an AppBarLayout , so I can use scroll flags to hide the toolbar on scrolling toward the top. The problem is that this only works with nested-scrolling-supported views. Most of the tabs - I mean, most of the pages - are support.v4.NestedScrollView s, so that is OK; others are (and need to be)