在设计 View 中使用百分比布局会引发异常:Exception raised during rendering: android/support/percent/R$styleable 或 Exception raised during rendering: 8 ava.lang.ArrayIndexOutOfBoundsException: 8 在 com.android.tools.idea.rendering.AarResourceClassGenerator.generateStyleable(AarResourceClassGenerator.java:210)
之前工作过,我今天更新了:Android Studio 2.0 Build #AI 9321
有没有办法回滚更新?
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
app:layout_widthPercent="50%"
app:layout_heightPercent="50%"
app:layout_marginTopPercent="25%"
app:layout_marginLeftPercent="25%"/>
</android.support.percent.PercentRelativeLayout>
api版本应指定为23,因为支持版本为23.2.1
最佳答案
- 确保您使用的是最新版本的库。
- 重启 Android Studio。
- 构建您的项目。
问题解决了!
关于android - 最新的 android studio 更新不支持百分比布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36639334/