How to add vertical scroll bar into relative layout

Shay Wilner 1,746 Reputation points
2024-07-10T19:59:58.0233333+00:00

Hello

in platform xamarin android

I have a relative layout and inside some text view i try to add a scroll bar as parent to the text views

but when i debug the app i get an exception

android.views.inflateexception scrollview can hosts only one direct child

i tried using linear layout in place inside the relative layout now i don't have exception but all freezes

thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,363 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shay Wilner 1,746 Reputation points
    2024-07-10T20:23:54.7066667+00:00

    I resolved by using 2 relative layout one relative as parent scrollview as child and the other relative

    layout as child of the scroll view

    like this

    <RelativeLayout
        android:layout_width="3dp"
            android:layout_height="wrap_content"
           >
            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
          <RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent">
        </RelativeLayout>
        </ScrollView>
        </RelativeLayout>
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.