Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c09d96

Browse files
committed
Fix calculating scrollbar handler position
Fix readme format and add info about ScrollBarPageIndicator
1 parent 247a41f commit 2c09d96

File tree

2 files changed

+33
-29
lines changed

2 files changed

+33
-29
lines changed

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,41 +47,41 @@ Use **ScrollBar** class to place scrollbar view near **PDFView**
4747

4848
1. in layout XML (it's important that the parent view is **RelativeLayout**)
4949

50-
``` xml
51-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
52-
android:layout_width="match_parent"
53-
android:layout_height="match_parent">
54-
55-
<com.github.barteksc.pdfviewer.PDFView
56-
android:id="@+id/pdfView"
50+
``` xml
51+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
5752
android:layout_width="match_parent"
58-
android:layout_height="match_parent"
59-
android:layout_toLeftOf="@+id/scrollBar"/>
60-
61-
<com.github.barteksc.pdfviewer.ScrollBar
62-
android:id="@+id/scrollBar"
63-
android:layout_width="wrap_content"
64-
android:layout_height="match_parent"
65-
android:layout_alignParentRight="true"
66-
android:layout_alignParentEnd="true" />
67-
68-
</RelativeLayout>
69-
```
53+
android:layout_height="match_parent">
54+
55+
<com.github.barteksc.pdfviewer.PDFView
56+
android:id="@+id/pdfView"
57+
android:layout_width="match_parent"
58+
android:layout_height="match_parent"
59+
android:layout_toLeftOf="@+id/scrollBar"/>
60+
61+
<com.github.barteksc.pdfviewer.ScrollBar
62+
android:id="@+id/scrollBar"
63+
android:layout_width="wrap_content"
64+
android:layout_height="match_parent"
65+
android:layout_alignParentRight="true"
66+
android:layout_alignParentEnd="true" />
67+
68+
</RelativeLayout>
69+
```
7070
2. in activity or fragment
71-
``` java
71+
``` java
7272

73-
@Override
74-
protected void onCreate(Bundle savedInstanceState) {
75-
super.onCreate(savedInstanceState);
73+
@Override
74+
protected void onCreate(Bundle savedInstanceState) {
75+
super.onCreate(savedInstanceState);
7676

77-
...
77+
...
7878

79-
PDFView pdfView = (PDFView) findViewById(R.id.pdfView);
80-
ScrollBar scrollBar = (ScrollBar) findViewById(R.id.scrollBar);
81-
pdfView.setScrollBar(scrollBar);
82-
}
79+
PDFView pdfView = (PDFView) findViewById(R.id.pdfView);
80+
ScrollBar scrollBar = (ScrollBar) findViewById(R.id.scrollBar);
81+
pdfView.setScrollBar(scrollBar);
82+
}
8383

84-
```
84+
```
8585

8686
Scrollbar styling:
8787
``` xml
@@ -95,6 +95,9 @@ Scrollbar styling:
9595
/>
9696
```
9797

98+
**ScrollBarPageIndicator** is added to scrollbar automatically and is shown while dragging scrollbar handler,
99+
displaying number of page on current position.
100+
98101
## Additional options
99102

100103
### Bitmap quality

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/ScrollBar.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ public Parcelable onSaveInstanceState() {
245245
/** methods for integration with PDFView */
246246
void addToPDFView(PDFView pdfView) {
247247
this.pdfView = pdfView;
248+
calculateHandlerHeight();
248249
pageChanged(pdfView.getCurrentPage());
249250
}
250251

0 commit comments

Comments
 (0)