android最佳布局显示将填充屏幕的图像按钮

时间:2011-11-11 18:55:07

标签: android layout

用于显示一系列图像按钮的最佳布局是什么,并排显示(如附图所示),当方向变为水平(如附图)时,它将水平填充屏幕?

horizontal orientation http://img254.imageshack.us/img254/657/layoutxs.png vertical orientation http://img208.imageshack.us/img208/2428/layouthy.png

3 个答案:

答案 0 :(得分:1)

看起来你想要使用像FlowLayout这样的东西,这在Android中是不存在的。但是,你可以制作自己的。更多信息

我有一个类似于你的布局的活动,但我使用了不同的方法。我所做的是为横向和纵向定义不同的xml布局。所以我有layout-port/mylayout.xmllayout-land/mylayout.xml,系统会确定活动应该使用哪一个。

答案 1 :(得分:1)

<GridView android:layout_width="fill_parent"
     android:layout_height="wrap_content" 
         android:numColumns="auto_fit" >
</GridView> 

答案 2 :(得分:0)

只需创建两个单独的布局文件,并在onOrientationChanged()中调用setContentView()。