Why doesn't my ScrollView scroll?

  • Thread starter Thread starter Darkmisc
  • Start date Start date
AI Thread Summary
The issue with the non-scrolling ScrollView was identified as being related to the height of the RadioGroup. Initially set to a fixed height, it prevented the ScrollView from functioning properly. Changing the RadioGroup's height to "wrap_content" resolved the problem, allowing the ScrollView to scroll as intended. The XML layout included a ConstraintLayout within the ScrollView, containing multiple CheckBoxes and a Button, which are now correctly displayed and scrollable.
Darkmisc
Messages
222
Reaction score
31
TL;DR Summary
I've used a ConstrainedLayout within a ScrollView and it's not scrolling at all.
Hi everyone

I've used a ConstrainedLayout in a ScrollView, and it won't scroll at all. Does anyone know that I've done wrong?

I've tried making the height 0dp and removing both instances of app:layout_constraintBottom_toBottomOf="parent", but it doesn't help. Below is the xml.

Thanks

[CODE lang="java" title="Menu"]<?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"
tools:context=".Menu">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:text="Choose characters" />

<RadioGroup
android:layout_width="227dp"
android:layout_height="721dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<CheckBox
android:id="@+id/a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ア a イ i ウ u エ e オ o" />

<CheckBox
android:id="@+id/k"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="カ ka キ ki ク ku ケ ke コ ko キャ kya キュ kyu キョ kyo
" />

<CheckBox
android:id="@+id/s"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="サ sa シ shi ス su セ se ソ so シャ sha シュ shu ショ sho
" />

<CheckBox
android:id="@+id/ta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="タ ta チ chi ツ tsu テ te ト to チャ cha チュ chu チョ cho" />

<CheckBox
android:id="@+id/na"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ナ na ニ ni ヌ nu ネ ne ノ no ニャ nya ニュ nyu ニョ nyo" />

<CheckBox
android:id="@+id/h"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ハ ha ヒ hi フ fu ヘ he ホ ho ヒャ hya ヒュ hyu ヒョ hyo" />

<CheckBox
android:id="@+id/m"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="マ ma ミ mi ム mu メ me モ mo ミャ mya ミュ myu ミョ myo" />

<CheckBox
android:id="@+id/y"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ヤ ya ユ yu ヨ yo" />

<CheckBox
android:id="@+id/r"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ラ ra リ ri ル ru レ re ロ ro リャ rya リュ ryu リョ ryo" />

<CheckBox
android:id="@+id/wa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ワ wa" />

<CheckBox
android:id="@+id/n"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ン n" /> <CheckBox
android:id="@+id/g"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ガ ga ギ gi グ gu ゲ ge ゴ go ギャ gya ギュ guy ギョ gyo" />

<CheckBox
android:id="@+id/z"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ザ za ジ ji ズ zu ゼ ze ゾ zo ジャ ja ジュ ju ジョ jo" />

<CheckBox
android:id="@+id/d"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ダ da ヂ (ji) ヅ (zu) デ de ド do" />

<CheckBox
android:id="@+id/b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="バ ba ビ bi ブ bu ベ be ボ bo ビャ bya ビュ byu ビョ byo" />

<CheckBox
android:id="@+id/p"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="パ pa ピ pi プ pu ペ pe ポ po ピャ pya ピュ pyu ピョ pyo" />

<CheckBox
android:id="@+id/f"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ファ fa フィ fi フェ fe フォ fo" />
<CheckBox
android:id="@+id/t"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ツァ tsa ティ ti トゥ tu" />

<CheckBox
android:id="@+id/w"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ウェ we ウォ wo" />

<CheckBox
android:id="@+id/all"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="all" /> </RadioGroup>

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="Button"
android:onClick="onClick"
tools:layout_editor_absoluteX="18dp"
tools:layout_editor_absoluteY="582dp" />

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>
[/CODE]
 
Technology news on Phys.org
I found the error.

The height of the radio group needed to be:
android:layout_height="wrap_content"
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Back
Top