简体   繁体   English

如何在顶部的imageview下对齐图像按钮

[英]How to align image button right under imageview which is at the top

Here my whole xml file. 这是我的整个xml文件。 I can not align image button at the bottom of imageview i have at the top 我无法在顶部的imageview底部对齐图像按钮

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".Pokemon$PlaceholderFragment"
style="@style/Base.TextAppearance.AppCompat.Display1"
android:clickable="true"
android:background="@drawable/monstermmorpg_android_bg">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:src="@drawable/application_text"
    android:adjustViewBounds="true"
    android:layout_alignParentTop="true"
 />

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageButton"
    android:background="@null"
    android:src="@drawable/image_button"
    android:adjustViewBounds="false"
    android:scaleType="centerInside"
 />

This is how it is displayed : i want it to be under imageview which is displayed at the top 它是这样显示的:我希望它位于显示在顶部的imageview下

Thank you very much i am using android studio latest on windows 8.1 - android version 2.3 api 9 非常感谢您我在Windows 8.1上使用最新的Android Studio-Android 2.3 API 9

在此处输入图片说明

add

android:layout_below="@id/imageView"

to the ImageButton. 到ImageButton。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM