Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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布局,将保持按钮在不同屏幕上的位置_Android_Xml_Android Layout - Fatal编程技术网

Android布局,将保持按钮在不同屏幕上的位置

Android布局,将保持按钮在不同屏幕上的位置,android,xml,android-layout,Android,Xml,Android Layout,在我的设计中,我必须把透明的图像按钮放在中央拨号盘上 我所做的是为中央刻度盘拍摄一个图像按钮。我还将在每个图标上放置透明按钮。并将使用onclickListener()查看按下了哪个按钮,并根据该按钮更新中心拨号背景以显示按下了哪个按钮 我对android编程非常陌生,所以这可能是一个非常糟糕的方法 现在我需要将按钮放置在图标上,我使用的是相对布局,当我尝试固定两个或更多按钮的位置时,第二个按钮和其他按钮会随着屏幕大小的变化而改变实际位置 这是我的xml 请帮助我了解如何在图标顶部放置按钮

在我的设计中,我必须把透明的图像按钮放在中央拨号盘上

我所做的是为中央刻度盘拍摄一个图像按钮。我还将在每个图标上放置透明按钮。并将使用onclickListener()查看按下了哪个按钮,并根据该按钮更新中心拨号背景以显示按下了哪个按钮

我对android编程非常陌生,所以这可能是一个非常糟糕的方法

现在我需要将按钮放置在图标上,我使用的是相对布局,当我尝试固定两个或更多按钮的位置时,第二个按钮和其他按钮会随着屏幕大小的变化而改变实际位置

这是我的xml



请帮助我了解如何在图标顶部放置按钮,使其在每个可用屏幕尺寸上都能保持其在刻度盘上的相对位置

您的英语不清楚。我想在不同屏幕尺寸上放置8个按钮,以保持其位置。当我使用如上所示的相对布局时,如果屏幕大小改变,按钮的位置也会改变。
<TableRow
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    android:id="@+id/tableRow">

    <ImageButton
        android:layout_width="0dip"
        android:layout_height="52dp"
        android:padding="10dip"
        android:layout_margin="4dip"
        android:layout_weight="1"

        android:id="@+id/ibRemote"
        android:src="@drawable/remote_selected"
        android:background="@android:color/transparent" />

    <ImageButton
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:layout_margin="4dip"
        android:layout_weight="1"

        android:id="@+id/ibUsers"
        android:src="@drawable/users"
        android:background="@android:color/transparent"
        android:baselineAlignBottom="true" />
    <ImageButton
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:layout_margin="4dip"
        android:layout_weight="1"

        android:id="@+id/ibArea"
        android:src="@drawable/areas"
        android:background="@android:color/transparent" />
    <ImageButton
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:layout_margin="4dip"
        android:layout_weight="1"

        android:id="@+id/ibTimer"
        android:src="@drawable/timer_icon"
        android:background="@android:color/transparent" />
</TableRow>

<ImageButton
    android:layout_width="288dp"
    android:layout_height="288dp"
    android:id="@+id/cdial"
    android:layout_alignParentEnd="false"
    android:background="@drawable/cd_inactive"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" />

<ImageButton
    android:layout_width="80dp"
    android:layout_height="35dp"
    android:id="@+id/disarmButton"
    android:background="@android:color/transparent"
    android:layout_alignTop="@+id/cdial"
    android:layout_marginTop="10dp"
    android:layout_centerHorizontal="true" />


  </RelativeLayout>