Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Eclipse图像视图移动它们_Android_Eclipse - Fatal编程技术网

Android Eclipse图像视图移动它们

Android Eclipse图像视图移动它们,android,eclipse,Android,Eclipse,我是android开发的新手,正在尝试移动我的两个图像视图,以便显示两个按钮相互平行。以下是到目前为止的屏幕截图: 更新代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/TopTwoButtons" android:layout_width="fill_parent" android:layout_height="wrap_content" andr

我是android开发的新手,正在尝试移动我的两个图像视图,以便显示两个按钮相互平行。以下是到目前为止的屏幕截图:

更新代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TopTwoButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_meduim"
android:gravity="center_horizontal" >

<ImageView
    android:id="@+id/ListButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginRight="39dp"
    android:layout_marginTop="130dp"
    android:src="@drawable/list_button_medium" />

<ImageView
    android:id="@+id/SearchButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignTop="@+id/ListButton"
    android:layout_marginLeft="20dp"
    android:src="@drawable/search_button_medium" />
</RelativeLayout>


<RelativeLayout
android:id="@+id/BottomTwoButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/TopTwoButtons"
android:gravity="center_horizontal" >

<ImageView
    android:id="@+id/InfoButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerInParent="true"
    android:layout_marginLeft="30dp"
    android:src="@drawable/info_button_medium" />

<ImageView
    android:id="@+id/PopularButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerInParent="true"
    android:layout_marginRight="30dp"
    android:src="@drawable/popular_button_medium" >



</RelativeLayout>


这是我的密码。我在第29行的第二个相对布局上得到了一个错误,它包含了两个第二个按钮。谢谢你,很抱歉我是个白痴,我只是习惯了在这个网站上做事。

正如你所说,我正在添加布局文件。请检查以下代码:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout 
android:id="@+id/TopTwoButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_meduim"
android:gravity="center_horizontal" >

<ImageView
    android:id="@+id/ListButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginRight="39dp"
    android:layout_marginTop="130dp"
    android:src="@drawable/list_button_medium" />

<ImageView
    android:id="@+id/SearchButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignTop="@+id/ListButton"
    android:layout_marginLeft="20dp"
    android:src="@drawable/search_button_medium" />
</RelativeLayout>


<RelativeLayout
android:id="@+id/BottomTwoButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/TopTwoButtons"
android:gravity="center_horizontal" >

<ImageView
    android:id="@+id/InfoButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerInParent="true"
    android:layout_marginLeft="30dp"
    android:src="@drawable/info_button_medium" />

<ImageView
    android:id="@+id/PopularButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerInParent="true"
    android:layout_marginRight="30dp"
    android:src="@drawable/popular_button_medium" />
</RelativeLayout>
</RelativeLayout>


Ok。你想如何显示图像?我想把按钮放在上面,上面有两个,下面有两个。我用的是线性布局,我猜这是相同的概念?是的,相同的概念。如果您使用的是LinearLayout,请为每个LinearLayout放置
android:orientation=“vertical”
。最好使用我在上面放置的RelativeLayouts。@Jack,你找到解决方案了吗?当我在相对布局中添加了你在线性布局代码中没有的XML代码时,事情变得一团糟,出现了一个错误(渲染期间引发的异常:android.widget.ImageButton无法转换为android.view.ViewGroup),不知道如何解决这个问题,也不知道我的代码出了什么问题。另外,我如何向您显示我的代码,这些注释框中不允许有那么多字符,谢谢。