[英]How to create a button on top of ImageView and align it to the bottom of the screen?
[英]Align ImageView bottom to a RelativeLayouts top
如何将ImageView的底部与RelativeLayout的顶部对齐?
即:
我需要这个:
╔╤╤╤╤╤╤╤╤╤╗
║ ║
║ImageView║
║ ║
╚╧╧╧╧╧╧╧╧╧╝
╔╤╤╤╤╤╤╤╤╤╗
║ ║
║ RtvLyt ║
║ ║
╚╧╧╧╧╧╧╧╧╧╝
对于这样的事情:
╔╤╤╤╤╤╤╤╤╤╗
║ ║
║ImageView║
║ ║
╠╪╪╪╪╪╪╪╪╪╣
║ ║
║ RtvLyt ║
║ ║
╚╧╧╧╧╧╧╧╧╧╝
知道如何在XML中做到这一点吗?
谢谢。
试试这个代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip" >
</RelativeLayout>
</LinearLayout>
感谢@Andrew T.,答案是在ImageView上执行android:layout_above="@+id/relativelayout"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.