Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 按钮与底部对齐,已从ImageView中隐藏_Java_Android_Xml_Xamarin - Fatal编程技术网

Java 按钮与底部对齐,已从ImageView中隐藏

Java 按钮与底部对齐,已从ImageView中隐藏,java,android,xml,xamarin,Java,Android,Xml,Xamarin,我想在布局的底部放置一个按钮。此外,我还放置了一个带有布局的图像视图,我的问题是,我的图像视图是隐藏我的按钮。 我怎样才能解决这个问题 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto

我想在布局的底部放置一个按钮。此外,我还放置了一个带有布局的图像视图,我的问题是,我的图像视图是隐藏我的按钮。 我怎样才能解决这个问题

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent" 
    android:layout_height="match_parent">

    <Button 
        android:id="@+id/btnGetMoreResults"
        android:layout_height="wrap_content" 
        android:layout_width="match_parent"     
        android:text="Get more"
        android:layout_alignParentBottom="true" />

    <ImageView
        android:layout_alignParentTop="true" 
        android:src="@android:drawable/ic_menu_gallery"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/btnGetMoreResults"
        android:id="@+id/imageView1" />

</RelativeLayout> 

看下面的图片


我应该使用CoordinatorLayout而不是RelativeLayout吗?

在ImageView中,不要使用

android:layout\u alignParentBottom=“true”

你必须使用

android:layout_over=“@+id/your_按钮”

这是最后的代码,别忘了根据需要修改它

<RelativeLayout
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_alignParentTop="true"
        android:layout_above="@id/button"
        android:layout_width="match_parent"
        android:layout_height="0dp"/>
    <Button
        android:id="@+id/button"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</RelativeLayout>

在ImageView中,不要使用

android:layout\u alignParentBottom=“true”

你必须使用

android:layout_over=“@+id/your_按钮”

这是最后的代码,别忘了根据需要修改它

<RelativeLayout
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_alignParentTop="true"
        android:layout_above="@id/button"
        android:layout_width="match_parent"
        android:layout_height="0dp"/>
    <Button
        android:id="@+id/button"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</RelativeLayout>

在imageview中使用此选项

android:margin_bottom="50dp";
在imageview中使用此选项

android:margin_bottom="50dp";



更改此android:layout_over=“@+id/btnGetMoreResults”及其工作无法复制您的问题。更改此android:layout_over=“@+id/btnGetMoreResults”及其工作无法复制您的问题。