<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
design:menu="@menu/bottom_menu_bar" />
应用程序级别的gradle。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
useLibrary 'org.apache.http.legacy'
/*splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
universalApk false
}
}*/
defaultConfig {
applicationId "user.com.hlthee"
minSdkVersion 17
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
res.srcDirs = ['src/main/res', 'src/main/assets/fonts']
}
}
dexOptions {
jumboMode true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
}
主题
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:background">@color/primary_background</item>
<item name="background">@color/primary_background</item>
<item name="android:colorPrimaryDark">@color/primary_background</item>
<item name="colorPrimaryDark">@color/primary_background</item>
<item name="android:navigationBarColor">@color/primary_background</item>
<item name="android:alertDialogTheme">@style/myDialog</item>
<item name="android:datePickerDialogTheme">@style/myDatePickertheme</item>
<item name="android:itemTextAppearance">@style/itemTextStyle.AppTheme</item>
<item name="itemTextAppearance">@style/itemTextStyle.AppTheme</item>
</style>
它在大于或等于 21 的 api 级别上工作得很好,但在 kitkat 中不起作用。我什至尝试过使用其他库,但输出是相同的。我确切地知道我的代码有什么问题。