Search code examples
androidrenderingandroid-percentrelativelayout

Android rendering problems, Percent layout


I'm trying to implement the percent relative layout, and I'm following this tutorial:

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

There doesn't seem to be any errors in my code, but there's still no preview, and it says:

"Rendering problems Exception raised during rendering: android/support/percent/R$stylable"

Any idea what's wrong?

My dependencies from 'build.gradle (Module:app)' are:

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'
} 

The two on the top were there from the beginning.

My XML file:

<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>

Solution

  • I think I solved it. Remove the padding attributes from the initialization tag. Hopefully, this will be of help to others with the same problem, cheers!