Hello,
My App contains many buttons, which are shown under each other, two per row. I generate the buttons dynamically via Java, which are them shown in the ConstraintLayout.
I have tried several layouts beside the ConstraintLayout, the TableView scrolling worked, however the button are not in the correct place then.
This is how the buttons are generated:
My App contains many buttons, which are shown under each other, two per row. I generate the buttons dynamically via Java, which are them shown in the ConstraintLayout.
Code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rootLayout"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
I have tried several layouts beside the ConstraintLayout, the TableView scrolling worked, however the button are not in the correct place then.
This is how the buttons are generated:
Java:
Button b = new Button(this);
b.setText(myClass.getTitle());
b.setTextColor(0xFFFFFFFF);
b.setX(buttonX);
b.setY(buttonY);
b.setWidth(buttonWidth);
b.setHeight(buttonHeight);
conLayout.addView(b);