【发布时间】:2018-01-08 18:53:11
【问题描述】:
我的活动的主要布局是LinearLayout。以它有两个孩子为例。一个RelativeLayout 和一个按钮。 RelativeLayout 的宽度和高度设置为 match_parent 和 Button,match_parent 和 wrap_content。不幸的是,RelativeLayout 按下下面的按钮,直到它不可见。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
为什么会这样?我尝试对RelativeLayout 进行调整,将高度更改为0dp,将重量更改为1。它确实使按钮可见,但我不确定这是否可取,因为我只更改了RelativeLayout 的高度和重量.
【问题讨论】:
标签: android android-linearlayout