【问题标题】:Android - android.view.InflateException with a custom viewAndroid - 带有自定义视图的 android.view.InflateException
【发布时间】:2012-03-28 12:01:19
【问题描述】:

您好,我一直收到此错误 它是第 9 行 xml 处的 android.view.InflateException

这是我的 xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<com.SpaceShot.single android:id="@+id/single1"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content">

 </com.SpaceShot.single>

<ListView android:id="@+id/highScores"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content">
</ListView>
</FrameLayout>

【问题讨论】:

  • com.SpaceShot.single 的超类是什么?根据具体情况,您需要为适当的公共构造函数提供膨胀逻辑所需的参数

标签: android


【解决方案1】:

你看过this类似的错误吗?在这种情况下,它说您应该在自定义 UI 项 2 构造函数中包含:
- 一个带有上下文参数
- 一个带有 Context 和 AttributeSet

【讨论】:

  • 我有。还有其他建议吗?
猜你喜欢
  • 1970-01-01
  • 2016-01-18
  • 1970-01-01
  • 1970-01-01
  • 2016-03-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-28
相关资源
最近更新 更多