1

我试图夸大这个观点

<LinearLayout android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="16dp">

    <TextView android:id="@android:id/text1"
        style="?android:textAppearanceLarge"
        android:textStyle="bold"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp" />


    <pdftron.PDF.PDFViewCtrl
        android:id="@+id/pdfviewctrl"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars = "vertical|horizontal" />

</LinearLayout>

在我的片段 onCreateView 函数中是这样的。

 View rootView =   inflater
            .inflate(R.layout.fragment_screen_slide_page, container, false);

但它返回一个错误“错误膨胀类pdftron.PDF.PDFViewCtrl”。任何人都可以指出原因(我成功地在活动中设置了这个布局,并且能够访问PDFViewCtrl并向它添加一个pdf文档。)在决定购买许可证之前,我只是想根据我的要求自定义 PDFTron。

完整的堆栈跟踪

FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #37: Error inflating class pdftron.PDF.PDFViewCtrl
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at com.example.viewpager.ScreenSlidePageFragment.onCreateView(ScreenSlidePageFragment.java:89)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1012)
at android.support.v4.view.ViewPager.populate(ViewPager.java:881)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1366)
at android.view.View.measure(View.java:8553)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3261)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8553)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8553)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3261)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8553)
at android.view.ViewRoot.performTraversals(ViewRoot.java:915)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1991)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4385)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 36 more
Caused by: java.lang.UnsatisfiedLinkError: PDFViewCtrlCreate
at pdftron.PDF.PDFViewCtrl.PDFViewCtrlCreate(Native Method)
at pdftron.PDF.PDFViewCtrl.a(SourceFile:1000)
at pdftron.PDF.PDFViewCtrl.<init>(SourceFile:1057)
... 39 more
4

1 回答 1

4

I was able to reproduce a similar error when I didn't initialize PDFNet before calling the inflater. Try calling PDFNet.initialize() before calling setContentView() or the inflater.

于 2013-04-01T23:49:34.123 回答