2016-04-05 89 views
2

我想實現的百分比相對佈局,而我下面這個教程:Android的渲染問題,百分比佈局

https://blog.stylingandroid.com/percent-part-1/

似乎有沒有在我的代碼的任何錯誤,但還是有沒有預覽,並說:

「渲染問題 異常渲染期間提出:安卓/支持/百分比/ R $風格化」

任何想法有什麼不對?

我從 '的build.gradle(模塊:APP)' 依賴關係:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:24.0.0-alpha1' 
    compile 'com.android.support:percent:23.0.0' 
} 

兩個頂部在那裏從一開始。

我的XML文件:

<android.support.percent.PercentRelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_paddingRightPercent="2%" 
    app:layout_paddingLeftPercent="2%" 
    app:layout_paddingBottomPercent="2%" 
    tools:context="companyname.appname.SeLister"> 

    <TextView android:text="Reklame" 
     app:layout_heightPercent="10%" 
     app:layout_widthPercent="50%" 
     android:id="@+id/listereklame" 
     android:textColor="#000000" 
     android:background="@drawable/tekstboks1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="16dp" 
     /> 

</android.support.percent.PercentRelativeLayout> 

回答

0

我想我解決了這個問題。從初始化標記中刪除填充屬性。希望這會對有同樣問題的人有幫助,歡呼!