【发布时间】:2013-09-19 21:15:49
【问题描述】:
我创建了一个新的 GLView 组件以添加到不同的项目中。正确构建库后,我尝试将其添加到我的测试应用程序中的 xml 布局中,但它似乎无法正常工作,因为它会引发 classnotfound 异常。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:lib="http://schemas.android.com/apk/res-auto"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@android:color/darker_gray">
<com.exapmple.library.CustomView
android:id="@+id/glsurfaceview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
而外部项目里面的类是:
public class CustomView extends GLSurfaceView
【问题讨论】:
-
这个答案可能有帮助吗? stackoverflow.com/questions/9833607/…
-
库就在那里,可以从代码中的任何地方调用。布局 xml 文件是问题所在。
标签: android android-custom-view