Android layout issue - linearlayout height doesn't fill scrollview height

I have a little problem installing Android ...

I have a ScrollView element containing a LinearLayout. I want scrollview to fill the entire screen of the device and linearlayout to fill the entire scroll height.

I have the code below, which causes scrollView to fill the entire screen, but linearLayout only fills half the scroll height.

Here is my code:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff036c07"> <LinearLayout android:background="#FF0000" android:id="@+id/overview_form" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> </LinearLayout> </ScrollView> 

Any ideas what I am missing?

+4
source share
3 answers

Add android:fillViewport="true" to the scroll list.

+10
source

Add

android:fillViewport="true" property in your ScrollView and

also remove the unnecessary namespace from linearlayout which

xmlns:android="http://schemas.android.com/apk/res/android"

+4
source

try adding weight attribute

android:weight="1" in linearlayout and check

0
source

Source: https://habr.com/ru/post/1502001/


All Articles