Android渲染问题,百分比布局

时间:2016-04-05 15:36:11

标签: android rendering android-percentrelativelayout

我正在尝试实现百分比相对布局,我正在学习本教程:

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

我的代码中似乎没有任何错误,但仍然没有预览,它说:

“渲染问题 渲染期间引发异常:android / support / percent / R $ stylable“

知道什么是错的吗?

来自'build.gradle(Module: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>

1 个答案:

答案 0 :(得分:0)

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

相关问题