Improve scrolling behavior of the MoveList area

Move the margin between the move list and the button row to the button
row container, so that the margin does not interfere with the
calculation in MoveListView.onMeasure().

Adjusted the MoveListView content size so that the last row can be
scrolled to a position where the previous line is completely hidden.
This commit is contained in:
Peter Osterlund 2020-01-13 21:42:08 +01:00
parent 9fbf7ff212
commit c19a3b3777
2 changed files with 6 additions and 5 deletions

View File

@ -139,12 +139,13 @@ public class MoveListView extends View {
int height = 0;
if (layout != null) {
height = layout.getLineCount() * getLineHeight();
int nLines = layout.getLineCount();
height = nLines * getLineHeight();
ViewParent p = getParent();
if (p != null)
p = p.getParent();
if (p instanceof MyRelativeLayout)
height += -getLineHeight() + ((MyRelativeLayout)p).getNewHeight();
height = getLineStartY(nLines - 1) + ((MyRelativeLayout)p).getNewHeight();
}
switch (MeasureSpec.getMode(heightMeasureSpec)) {
case MeasureSpec.UNSPECIFIED:

View File

@ -42,7 +42,8 @@
android:id="@+id/buttons"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="4dp">
<ImageButton
android:id="@+id/custom3Button"
@ -91,8 +92,7 @@
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="4dp">
android:layout_height="fill_parent">
<view
class="org.petero.droidfish.view.MoveListView"