Android渲染问题,百分比布局

3
我正在尝试实现百分比相对布局,并且我正在按照这个教程进行操作: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

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接