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”及其工作无法复制您的问题。