是否可以一起使用GridLayout(或TableLayout)和相对布局?

时间:2014-06-01 02:18:33

标签: android button relativelayout grid-layout

我正在开发一个Android应用程序,在应用程序中,我计划使用gridlayout按钮覆盖图像。我可以使用ImageView显示图像,但我似乎找不到用图形按钮覆盖图像的方法。到目前为止,我可以有一个按钮网格,但是当我想要它在网格下面时,图像也会在网格中。有没有办法让我可以用按钮网格覆盖图像?在此先感谢,也让我知道如果我太模糊,我在这里很难说清楚我的问题。

1 个答案:

答案 0 :(得分:0)

你的问题有点模糊,有了这样的东西,你想要的图像会有所帮助。但是,听起来您希望将图像作为背景,并在此图像的顶部放置Button s。

为此,您可以使用最适合您所需要的ViewGroupRelativeLayoutLinearLayout等...),并将背景作为您需要的图像。

<RelativeLayout
    ...
    android:background="@drawable/myImage"/>   <!-- where myImage is the image you
                                                  want as your background -->

然后使用您的GridLayout或任何您想要用作ViewGroup用作根ViewGroup的孩子。

<RelativeLayout
    ...
    android:background="@drawable/myImage"/>   <!-- where myImage is the image you
                                                  want as your background -->
    <GridLayout
          .../>