我想做一个可滚动的布局,其中包含许多相关布局和按钮。 (见下面的例子)。但我每次做一个滚动视图时,它说滚动视图可以包含一个子......使用按钮滚动布局!
例
滚动型
Relativelayouts1
Button1
Relativelayouts2
Button2
Relativelayouts3
Button3
Relativelayouts4
Button4
滚动型(END)
我想做一个可滚动的布局,其中包含许多相关布局和按钮。 (见下面的例子)。但我每次做一个滚动视图时,它说滚动视图可以包含一个子......使用按钮滚动布局!
例
滚动型
Relativelayouts1
Button1
Relativelayouts2
Button2
Relativelayouts3
Button3
Relativelayouts4
Button4
滚动型(END)
这个问题的解决是简单...用一个布局包装子布局。例如,如下所示。
ScrollView
LinearLayout
Relativelayouts1
Button1
Relativelayouts2
Button2
Relativelayouts3
Button3
Relativelayouts4
Button4
你为什么想要4个RelativeLayouts?它打破了布局的目的。最有可能的是,您可以使用相同的结果:
<ScrollView>
<RelativeLayout>
<Button/>
<Button/>
<Button/>
<Button/>
</RelativeLayout>
</ScrollView>
这样可以避免浪费宝贵的资源来生成无用的视图。
把你的时间来阅读这篇文章:http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/(和部分2和3也)
这是按钮布局方式。他们不是另一个人的榜样。他们在特定的群体。 – IntelSoftApps 2011-05-29 20:49:15
这就是RelativeLayout的意思。 – Aleadam 2011-05-30 04:50:06
谢谢!现在我可以完成我正在做的事情! – IntelSoftApps 2011-05-29 20:49:37