ScrollView can host only one direct child?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



ScrollView can host only one direct child?



As you can see, my scrollview doesn't have anything inside of it. I am trying to add a relativelayout so I can place switches inside the scroll view. I do not have any other code pertaining to scroll view as of now. Does anyone know why I am getting this error? Error: ScrollView can host only one direct child?



Here is the xml code:


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="260dp"
android:layout_height="120dp"
android:background="@android:color/black"
android:scrollbarSize="5dp">
</ScrollView>



Here is the java code:


SV = menuView.findViewById(R.id.ScrollView01);

final RelativeLayout RL2 = new RelativeLayout(this);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
RL2.setLayoutParams(layoutParams2);

if(SV !=null)
SV.addView(RL2);





There's not enough information here to determine the exact cause. You'll need to provide a Minimal, Complete, and Verifiable example, along with the complete stack trace, not just the Exception message.
– Mike M.
Aug 12 at 23:00









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

React Native Navigation and navigating to another Screen problem