Reputation: 2545
I try to use ScrollView and a TableLayout inside of ScrollView like this:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Input text: " />
<EditText
android:id="@+id/weightEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal" >
<requestFocus />
</EditText>
</TableRow>
</TableLayout>
</ScrollView>
But it doesn't work. Scroll bars doesn't display if even my content is too large. Does anyone have any suggestions why it works like this?
Upvotes: 1
Views: 4814
Reputation: 8781
Try changing the scrollview layout_height to match_parent like this:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" >
When you use wrap_content your scrollview will just grow larger even when the screen ends, but when using match_parent your scrollview will fit the screen and when the content of the scrollview overflows it will show scrollbars.
Rolf
Upvotes: 3