答案 0 :(得分:3)
尝试以下步骤
include ':libs:<libarary project name>'
compile project(':libs:<libarary project name>')
这应该有效:)
答案 1 :(得分:2)
包含图书馆的步骤
1.Open your android studio project
2.Click Scripts Gradle(Left appears)
2.Go to build.gradle (Module: app)
3.Add this library in dependences section with this line:
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
4.Click Sync Now.
5.Now you can add material design elements as it appears on the website of the library.
示例 按钮材料设计
gradle这个
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "co.com.witz.materialdesign"
minSdkVersion 15
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.0.1'
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
}
MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
}
main_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonflat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#1E88E5"
android:text="Button"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
<强> RESULT 强>
如果你想要的是使用更多的材料设计元素,我将链接留给你可以轻松使用的大型纲要Github。