'List View Constrain jump to top
I am trying to learn SQL database with a tutorial. I add user and age to database and get them back and displayed using listView using ViewAll button then if i trying to add another user the list view jump to top how can i fix this i am a noob need help
XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/lv_customerList"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/et_namex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/CustomerName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/et_agex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/Age"
android:inputType="number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/et_namex" />
<Switch
android:id="@+id/Sw_activex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ActiveCustomer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/et_agex" />
<Button
android:id="@+id/btn_viewAllx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="ViewAll"
app:layout_constraintEnd_toStartOf="@+id/btn_Addx"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Sw_activex" />
<Button
android:id="@+id/btn_Addx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/btn_viewAllx"
app:layout_constraintTop_toTopOf="@+id/btn_viewAllx" />
<ListView
android:id="@+id/lv_customerListx"
android:layout_width="410dp"
android:layout_height="563dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.988" />
</androidx.constraintlayout.widget.ConstraintLayout>
this is how its look when its run
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


