0

Do android:layout_...s work with ImageViews? From the picture you can see that all 10 rows are on top of each other so that means that q2Image is not accepting the code android:layout_below="@/q1Image" for it to drop down a line and star the next row.

Am I just missing something or am I trying to do something that is impossible?

<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"  /> 

        <View 
            android:layout_width="fill_parent"
            android:layout_height="1dp"       
            android:background="#C2BEBF" />

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

        <TextView 
            android:id="@+id/q2Question"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/q2Image" /> 

        <TextView 
            android:id="@+id/q2Answer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"   
            android:layout_toRightOf="@id/q2Question"  /> 

        <TextView 
            android:id="@+id/q2Verse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"   
            android:layout_toRightOf="@id/q2Answer"  /> 

        <View 
            android:layout_width="fill_parent"
            android:layout_height="1dp"       
            android:background="#C2BEBF" />
//Above code is first 2 rows.  There are 10 rows total but I removed the code for rows 3-10 for this post.

enter image description here

Matt
  • 3,882
  • 14
  • 46
  • 89

3 Answers3

1

Try to put + between @ and id and everything must be ok

@+id

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

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

        <!-- here the columns -->
    </LinearLayout>

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

        <!-- here the columns -->
    </LinearLayout>
    .
    .

</LinearLayout>
Festus Tamakloe
  • 11,231
  • 9
  • 53
  • 65
0

Referencing Id's like that not always working. Replace "@id" with "@+id" everywhere. Example:

android:layout_below="@+id/q1Image"
Yaroslav Mytkalyk
  • 16,950
  • 10
  • 72
  • 99
0

The way you are accessing the ids in the code is correct. "@+id" is used to declare the id. All references to it following the declaration should be "@id". Are you having the same problems with the TextViews also? I think you should set the layout_below property for the TextViews as well. Because I can see text is also overlapped in your UI. eg.,

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

RelativeLayout will not place a view below another unless you specify layout_below for it. Hence your TextViews appear overlapped.

Poonam Anthony
  • 1,848
  • 3
  • 17
  • 27