2

PDF ビューで注釈を使用したいと考えています。

PDFをロードするために、私はAndroidPdfViewer ライブラリを使用しました

これで、プログラムでビューを追加しました。

ScrollView -scrollviewテキストを編集するものを使用すると、キーボードが開くとすぐに、追加したカスタムscrollviewが使用可能な画面領域にサイズ変更されます。現在、私のPDFビューとカスタムビューは同期されておらず、他の多くの提供されたソリューションにカスタムオフセットを与えようとしましたが、私の場合は機能しません. では、どうすれば両方を同期させることができますか、つまり、両方のビューを同じ y 位置にスクロールさせることができますか。

android:windowSoftInputMode="adjustResize"マニフェストに設定しています。

activity_main.xml ファイル。

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parent_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.github.barteksc.pdfviewer.PDFView
        android:id="@+id/pdfView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </com.github.barteksc.pdfviewer.PDFView>

</RelativeLayout>

プログラムで追加されたレイアウトは、

     ScrollView scrollView = new ScrollView(this);
            scrollView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 100000));
            scrollView.setBackgroundColor(ContextCompat.getColor(this, R.color.bg2));

  EditText et = new EditText(this);
                et.setPadding(10, 10, 0, 0);
                et.setTextSize(8);
                et.setGravity(Gravity.TOP);
                et.setBackground(getResources().getDrawable(R.drawable.edittext_border));

scrollview.addView(et);

pdfView.addView(scrollview); // pdfView = findViewById(R.id.pdfView);

プログラムで追加された注釈サブビューをキーボード上でスクロール可能にする方法、またはキーボードが開いている間にPDFと注釈ビューを同期してスクロールする方法。

4

0 に答える 0