0
这就是我想要的:android.support.v7.widget.Toolbar不是棉花糖设备工作正常
这就是我得到:
这个问题带有api 23.在22或21上,它给出了第一个图像所示的结果。
我的build.gradle是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.bob"
minSdkVersion 15
targetSdkVersion 22
versionCode 3
versionName "1.0.1"
}
buildTypes {
release {
minifyEnabled false
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile files('libs/android-query-full.0.26.7.jar')
compile files('libs/android-async-http-1.4.4.jar')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.0'
compile'com.github.wrdlbrnft:sorted-list-adapter:0.1.0.5'
compile ('jp.wasabeef:recyclerview-animators:2.2.3'){
exclude module: 'appcompat-v7'
}
}
而且我的Android布局文件是:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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="true"
tools:context=".SongList">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<!--
app:layout_scrollFlags="scroll|enterAlways"/>
-->
</android.support.design.widget.AppBarLayout>
<include layout="@layout/song_list" />
</android.support.design.widget.CoordinatorLayout>
而且Toolbar
集的Java文件:
setContentView(R.layout.activity_songlist);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
我不想升级编译和目标版本bcz然后我将不得不为每一个添加运行时权限方法清单中指定的权限。
你在'song_list'布局中添加了布局行为? –
是的...我已经添加了像这样的应用程序:layout_behavior =“@ string/appbar_scrolling_view_behavior”@Uttam Panchasara –
此代码可以正常使用棒棒糖和更低版本。该问题只出现在棉花糖装置中。 –