【问题标题】:Align top imageView with the center of a relativeLayout将顶部 imageView 与 relativeLayout 的中心对齐
【发布时间】:2014-05-02 12:37:52
【问题描述】:

如何设置imageView的布局参数才能得到这样的东西?

谢谢!!

【问题讨论】:

  • 使用Layout Top,bottom,right,left Margins来调整

标签: android xml view android-relativelayout


【解决方案1】:

我准备了一个简单的黑客解决方案。 转储View 并将您的View Top 分配给它。

<View
    android:id="@+id/view1"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true" />

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@id/view1"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_launcher" />

希望这可以帮助你...欢迎任何查询 :)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2016-07-20
    相关资源
    最近更新 更多