2016-04-05 53 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

我想我解决了这个问题。从初始化标记中删除填充属性。希望这会对有同样问题的人有帮助,欢呼!