I am using the new Android Design Library based on this example chrisbanes/cheesesquare in github and here
I have run the example and I am having problems with Toolb
Change your Design Library with New Version build.gradle file in app folder like:
compile 'com.android.support:design:22.2.1'
As Updated in +AndroidDevelopers
I got output like:
It will helps you.
Thanks :)
I had same problem, my toolbar was displaying wrong on API level greater than 21. I was using android.support.v7.widget.Toolbar as supportActionBar() and below content is in fragment, see pictures: on aplication start, toolbar is displaying wrong and when i colapse android.support.design.widget.CollapsingToolbarLayout, the picture is not hidden completely
I resolved this when i added android:fitsSystemWindows="true" attribute to the root element of view where Toolbar is located.
Now: toolbar is displaying normal and picture is hidden completely
had the same problem put in style with windowActionBar and windowNoTitle and decided my problem.
<style name="AppTheme.base" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Looks like this is a bug in com.android.support:design:22.2.0
.
It will be fixed, it's marked as future release. So lets hope it will be soon.
Links with issues:
https://code.google.com/p/android/issues/detail?id=175240
and https://code.google.com/p/android/issues/detail?id=175069
Here is some working workaround for API 21:
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
marginResult = 0;
int resourceId = getResources().getIdentifier(getString(R.string.identifier_status_bar_height), getString(R.string.identifier_dimen), getString(R.string.identifier_android));
if (resourceId > 0) {
marginResult = getResources().getDimensionPixelSize(resourceId)*2;
}
CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) mToolbar.getLayoutParams();
params.topMargin -= marginResult;
mToolbar.setLayoutParams(params);}