拉动刷新示例,错误

时间:2012-06-26 11:11:57

标签: android

我正在尝试将“pull to refresh”小部件添加到我的代码中,我只是使用这个示例:

https://github.com/johannilsson/android-pulltorefresh

所以,我创建了pullToRefresh包,用eclipse生成一个jar文件并将其导入其他包中,我收到了这个错误:

06-26 10:55:05.482: E/AndroidRuntime(508): FATAL EXCEPTION: main 
06-26 10:55:05.482: E/AndroidRuntime(508): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.pull/example.pull.PullToRefreshExampleActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.pull.widget.pullToRefresh
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread.access$500(ActivityThread.java:122)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.os.Looper.loop(Looper.java:132)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread.main(ActivityThread.java:4123)
06-26 10:55:05.482: E/AndroidRuntime(508):  at java.lang.reflect.Method.invokeNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508):  at java.lang.reflect.Method.invoke(Method.java:491)
06-26 10:55:05.482: E/AndroidRuntime(508):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-26 10:55:05.482: E/AndroidRuntime(508):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-26 10:55:05.482: E/AndroidRuntime(508):  at dalvik.system.NativeStart.main(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.pull.widget.pullToRefresh
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.createView(LayoutInflater.java:596)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
06-26 10:55:05.482: E/AndroidRuntime(508):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:223)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.Activity.setContentView(Activity.java:1786)
06-26 10:55:05.482: E/AndroidRuntime(508):  at example.pull.PullToRefreshExampleActivity.onCreate(PullToRefreshExampleActivity.java:21)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.Activity.performCreate(Activity.java:4397)
06-26 10:55:05.482: E/AndroidRuntime(508):  at  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
06-26 10:55:05.482: E/AndroidRuntime(508):  ... 11 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: java.lang.reflect.InvocationTargetException
06-26 10:55:05.482: E/AndroidRuntime(508):  at java.lang.reflect.Constructor.constructNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508):  at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.createView(LayoutInflater.java:576)
06-26 10:55:05.482: E/AndroidRuntime(508):  ... 22 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: android.content.res.Resources$NotFoundException: File pulltorefresh from xml type layout resource ID #0x7f030000
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:2135)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:2090)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.Resources.getLayout(Resources.java:849)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.view.LayoutInflater.inflate(LayoutInflater.java:389)
06-26 10:55:05.482: E/AndroidRuntime(508):  at com.pull.widget.pullToRefresh.init(pullToRefresh.java:92)
06-26 10:55:05.482: E/AndroidRuntime(508):  at com.pull.widget.pullToRefresh.<init>(pullToRefresh.java:66)
06-26 10:55:05.482: E/AndroidRuntime(508):  ... 25 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: java.io.FileNotFoundException: pulltorefresh
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.AssetManager.openXmlAssetNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
06-26 10:55:05.482: E/AndroidRuntime(508):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:2117)
06-26 10:55:05.482: E/AndroidRuntime(508):  ... 30 more

我认为更重要的是: -

06-26 10:55:05.482: E/AndroidRuntime(508):  at com.pull.widget.pullToRefresh.init(pullToRefresh.java:92)

这一行:

mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);

在创建的包中的“pullToRefresh.java”中。

从包裹中,它会发生什么?

提前致谢

0 个答案:

没有答案