【问题标题】:How to center a ImageView at bottom background layout如何在底部背景布局中居中 ImageView
【发布时间】:2014-06-18 13:02:04
【问题描述】:

我有一个只显示背景图像的标题。

<RelativeLayout
    android:id="@+id/rl_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/header_bg
    android:orientation="horizontal" >

我想在背景布局的底部添加一个圆形图像,并且像这样将圆形图像居中! circular image at bottom background 有人可以帮我解决这个问题吗@Thanks

【问题讨论】:

  • 使用FrameLayout 将视图堆叠在一起。这样,您可以将圆形图像与背景图像对齐。

标签: java android xml layout


【解决方案1】:

尝试使用android:layout_centerInParent="true"

【讨论】:

    【解决方案2】:

    您可以像这样添加ImageView

    <RelativeLayout
        android:id="@+id/rl_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/header_bg"
        android:orientation="horizontal" >
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            android:src="{Your drawable}" />
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-07
      • 1970-01-01
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      • 2021-07-02
      • 2015-09-23
      相关资源
      最近更新 更多