Skip to content Skip to sidebar Skip to footer

RelativeLayout Inside Of ScrollView - Android

I am changing my whole layout for this activity from a TableLayout to RelativeLayout for various reasons. I have 10 'rows' I want inside of this RelativeLayout but right now I am

Solution 1:

If I read it correctly and you are referring to this ScrollView:

<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="65"
        android:fillViewport="true" >

        <RelativeLayout 
            android:layout_width="fill_parent"   
            android:layout_height="wrap_content"> 

            <ImageView 
                android:id="@+id/q1Image"
                android:layout_width="10dp"
                android:layout_height="10dp"  /> 

            <TextView 
                android:id="@+id/q1Question"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/q1Image"   /> 

            <TextView 
                android:id="@+id/q1Answer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"   
                android:layout_toRightOf="@id/q1Question"  /> 

            <TextView 
                android:id="@+id/q1Verse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"   
                android:layout_toRightOf="@id/q1Answer"  /> 
        </RelativeLayout>
    </ScrollView>

Your TextView's layout_width was set to 0dip when you need a wrap_content or static width. Also your TextView q1Question was not attached to the right of ImageView q1Image. Unless of course you wanted it stacked ontop of the ImageView.


Solution 2:

Looks like your views inside of your imageView have a width of 0dip and no weight. Could you correct that ?

Also, you could remove the weights on the TableRows and set them to match_parent.


Post a Comment for "RelativeLayout Inside Of ScrollView - Android"