2016-08-03 69 views
0

我想使用PercentRelativeLayout但gradle不會找到罰款的相關資源標識符。不能讓android工作室識別PercentageRelativeLayout

這是我的佈局(在列表視圖簡單項目)

<?xml version="1.0" encoding="utf-8"?> 
<android.support.percent.PercentRelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:clickable="true"> 


    <ImageView 
     app:layout_widhtPercent="30%" 
     android:layout_height="wrap_content" 
     android:id="@+id/projects_lv_item_image" /> 

    <TextView 
     app:layout_widhtPercent="60%" 
     android:layout_height="wrap_content" 
     android:id="@+id/projects_lv_item_title" /> 
</android.support.percent.PercentRelativeLayout> 

這是我builde.gradle文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.devlopers.yemima.kh1" 
     minSdkVersion 19 
     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:24.1.1' 
    compile 'com.android.support:support-v4:24.1.1' 
    compile 'com.android.support:percent:24.1.1' 


} 

這是我從Android Studio中得到的錯誤:

Error:(11) No resource identifier found for attribute 'layout_widhtPercent' in package 'com.devlopers.yemima.kh1' 

你的幫助會非常讚賞

回答

5

你拼錯了:它不是layout_wid**ht**Percent而是layout_widthPercent