【发布时间】:2012-04-26 20:38:43
【问题描述】:
我正在尝试实现由 Patrik Akerfeldt 开发的 android-viewflow 应用程序。 源码在这里:https://github.com/pakerfeldt/android-viewflow
我已将“view-flow”文件夹添加为库项目并在我的应用程序中引用它。当我想使用“org.taptwo.android.widget.TitleFlowIndicator”时,编译器给出以下错误:
“原因:android.view.InflateException: Binary XML file line #9: Error inflating class org.taptwo.android.widget.TitleFlowIndicator”
这是 .xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.alperen.osman.deneme"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:gravity="center_horizontal" android:id="@+id/header_layout"
android:orientation="vertical" android:layout_height="wrap_content">
<org.taptwo.android.widget.TitleFlowIndicator
android:id="@+id/viewflowindic" android:layout_height="wrap_content"
android:layout_width="fill_parent"
app:footerLineHeight="2dp"
app:customTypeface="fonts/Antic.ttf"
app:footerTriangleHeight="10dp" app:textColor="#FFFFFFFF" app:selectedColor="#FFFFC445" app:footerColor="#FFFFC445"
app:titlePadding="10dp" app:textSize="11dp" app:selectedSize="12dp" android:layout_marginTop="10dip" app:clipPadding="5dp">
</org.taptwo.android.widget.TitleFlowIndicator>
</LinearLayout>
<org.taptwo.android.widget.ViewFlow
android:duplicateParentState="true" android:id="@+id/viewflow"
android:layout_width="fill_parent" android:layout_height="fill_parent"></org.taptwo.android.widget.ViewFlow>
</LinearLayout>
这个小部件在 .java 代码中使用如下:
...
TitleFlowIndicator indicator = (TitleFlowIndicator) findViewById(R.id.viewflowindic);
indicator.setTitleProvider(adapter);
viewFlow.setFlowIndicator(indicator);
...
我在这里缺少什么?任何帮助将不胜感激。谢谢
【问题讨论】:
-
在 Eclipse 中使用
adb logcat、DDMS 或 LogCat 视图检查 LogCat 并查看与您的错误相关的完整堆栈跟踪。 -
我已经使用过 logcat DDMS 并检查了错误的 full 堆栈跟踪。然后我发布了这个问题。
-
“我已经使用 logcat DDMS 并检查了错误的完整堆栈跟踪”——如果你有,你会发现实际的异常,而不是你粘贴的异常。您粘贴的内容基本上是说“我们遇到了问题 - 继续阅读以找到实际的异常”。
-
查看错误的完整堆栈跟踪可能会有所帮助