Reputation: 56
I want to use Material.Light.Panel theme when i'm using AndroidStudio preview,but in Select Theme dialog, I cannot find it.
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
androidExtensions {
experimental = true
}
android {
compileSdkVersion 28
androidExtensions {
experimental = true
}
defaultConfig {
applicationId "com.dslx.electronicclassboard"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi","armeabi-v7a"
}
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:recyclerview-v7:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:design:$support_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
}
How can I find this theme?
Upvotes: 1
Views: 362
Reputation: 3801
Add Dependency for Material Theme in your app gradle.
implementation 'com.google.android.material:material:1.1.0-alpha05'
Then change theme in your styles.xml to <style name="AppTheme" parent="Theme.MaterialComponents.Light">
.
After that change the preview theme you can find the option for material themes as shown in the image.
Upvotes: 1
Reputation: 88
The theme is not set in your build.gradle, but in a styles.xml file located under res->layout->values
<style name="AppTheme" parent="Theme.AppCompat.Light"/>
From here you can set the theme for your app in your manifest file
android:theme="@style/AppTheme"
Upvotes: 0