我正在努力扩大这种看法

<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膨胀”。任何人都可以指出原因(我在活动中成功设置了ContentView的布局,并能够访问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

最佳答案

当我在调用充气机之前未初始化PDFNet时,能够重现类似的错误。在调用setContentView()或充气机之前,请尝试调用PDFNet.initialize()。

08-18 12:10