2017-08-20 56 views
0

我正在嘗試實現Vector Drawable Library。我更新了我的代碼,但遇到了一個新問題。現在圖像/矢量根本不顯示啓用並使用Vector Drawable Library後,矢量並未顯示

搖籃文件

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.0" 
    defaultConfig { 
     applicationId "com.kanudo.ten" 
     minSdkVersion 14 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     vectorDrawables.useSupportLibrary = true 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.0', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    testImplementation 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:26.0.1' 
    compile 'com.android.support:recyclerview-v7:26.0.1' 
} 

佈局文件

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto"> 

    <ImageView 
     android:id="@+id/imageView" 
     app:srcCompat="@drawable/ic_note_outlines" 
     android:layout_width="24dp" 
     android:layout_height="24dp" /> 

</RelativeLayout> 

感謝

回答

0

有一種思念......

對於工作要求它使用<android.support.v7.widget.AppCompatImageView>代替<ImageView>

或/與

一個人必須從AppCompatActivity而不是Activity

延長 MainActivity