1

我需要知道如何在 ImageView 上放置两个重叠的导航按钮。为了清楚起见,我想在 ImageView 中使用上一个和下一个导航按钮。

4

3 回答 3

1

为什么使用ImageView你可以使用 aLayout并设置它的背景。然后根据需要放置按钮。

如果你坚持使用和ImageView

<RelativeLayout
  android:layout_height="..."
  android:layout_width="...">

  <ImageView
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>
  <!-- put the buttons in here as you like -->

</RelativeLayout>
于 2012-06-30T15:02:27.353 回答
1

包装ImageViewRelativeLayout并使用`android:layout_alignTop="@+id/imageView"。

于 2012-06-30T15:04:55.953 回答
1

使用此布局在左上角将您image的两个包裹起来。buttons

 <RelativeLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <ImageView 
            android:src="@drawable/ic_launcher"
            android:layout_alignTop="true"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignBottom="true"/>
        <Button
            android:id="@+id/buttonLeft"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"/>
        <Button
            android:id="@+id/buttonRight"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_toLeftOf="@id/bbuttonLeft"/>

    </RelativeLayout>
于 2012-06-30T15:06:43.737 回答