在 build.gradle 的依赖项部分添加 appcompat-v7 和 leanback
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:leanback-v17:23.1.1'
在 style.xml
<style name="AppTheme" parent="@style/Theme.Leanback">
参考:https ://developer.android.com/tools/support-library/features.html#v17-leanback
在主要活动(启动器)下的 AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
示例 build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.COMPANYNAME.something"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:leanback-v17:23.1.1'
compile 'com.android.support:design:23.1.1'
}