---
title: "ScrollView仅支持一个子项，报错ScrollView can host only one direct child"
author: "helpbs"
date: "2012-03-06T17:30:00Z"
tags: []
slug: "scrollview-scrollview-can-host-only-one-direct-child"
draft: false
lastmod: "2012-04-20T18:27:26Z"
id: 1491925
url: "https://helpbs.iteye.com/blog/1491925"
---

LogCat 报错信息：

发生错误原因分析：

ScrollView仅支持一个子项。

查看对应的layout xml，发现ScrollView中有两个子项。

解决办法：

在ScrollView 中设LinearLayout为子项 ，将其它View放入LinearLayout。

PS. 在Error Log中有错误提示。但在编辑layout xml 时未开启“Error Log”窗口，未发现报错。

其实“Graphical Layout” 中也会有报错提示