Search code examples
androidxmlmobilehorizontalscrollview

Android Wear HorizontalScrollView doesn't have a closing tag


I have to add a HorizontalScrollView in my android wear client. Normally, on the handset, we'll have

<HorizontalScrollView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/horizontalScrollView2"
     android:layout_gravity="center_horizontal|bottom" />

and with the closing tag </HorizontalScrollView>.
In the wear project, I noticed the horizontalScrollView doesn't have a closing tag. Does anyone know how does that work on the wear? Thank you in advance.


Solution

  • There's a closing tag for the HorizontalScrollView on Android-Wear as well, but in the sample code you've shared with us the HorizontalScrollView is already closed via />.
    So to clear things up:

    />

    is equal to:

    <HorizontalScrollView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
    </HorizontalScrollView>
    

    With the only difference that you can't place views within the ScrollView when you're writing />.