ScrollView doesn't play well with RelativeLayout

So I have a ScrollView as the highest level in my layout ... inside my ScrollView, I have a RelativeLayout that contains other views. The problem is that the RelativeLayout doesn't cover the whole layout as it should, it gets cut off about half the screen. The width of this width is the full width of the screen, but the RelativeLayout's height stops where the bottom of the ImageView is. here is my layout code:

<?xml version="1.0" encoding="utf-8"?>    
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" 
android:background="@drawable/graybck">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<ImageView
    android:id="@+id/pPicture"
    android:layout_width="200dip"
    android:layout_height="300dip"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" />

<TextView
    android:id="@+id/pName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginTop="29dp"
    android:layout_toRightOf="@+id/pPicture"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/pBio"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/pName"
    android:layout_below="@+id/pName"
    android:layout_marginTop="22dp"
    android:text="Medium Text"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/stats"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignTop="@+id/pName"
    android:layout_marginRight="266dp"
    android:text="Loading Stats..." />

</RelativeLayout>

</ScrollView>

      

Any help is greatly appreciated!

+3


source to share


2 answers


<Scrollview> 
    <LinearLayout>
        <RelativeLayout>
        inner part here ...
        </RelativeLayout>
    </LinearLayout>  
</Scrollview>

      



Try using something like this.

+7


source


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >

      



+1


source







All Articles