如何在Android Studio 2.3.3中更改相对布局的布局高度?

如何在Android Studio 2.3.3中更改相对布局的布局高度?,android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,我是Android编程的初学者,目前正在Udacity学习Android基础知识。在本课程的第二部分中,有一个制作生日卡应用程序的示例。老师示范了如何使用 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" /> 但Android Studio一直在将其更改为 <RelativeLayout android:layout_he

我是Android编程的初学者,目前正在Udacity学习Android基础知识。在本课程的第二部分中,有一个制作生日卡应用程序的示例。老师示范了如何使用

 <RelativeLayout
   android:layout_width="match_parent"
  android:layout_height="match_parent" /> 

但Android Studio一直在将其更改为

<RelativeLayout 
   android:layout_height="0dp"
   android:layout_width="0dp"
   tools:layout_editor_absoluteY="8dp"
   tools:layout_editor_absoluteX="8dp" />


我也不能使用android:layout\u alignParentBottom=“True”

这是因为您使用的是新版android studio。只是编码 这样,您的整个容器将充满相对布局

android:layout_width="fill_parent"
android:layout_height="fill_parent"

在AndroidStudio 2.3.3中,主根布局是
constraint
layout,因此将其删除并使用
relative/linear
layout

<RelativeLayout 
   android:layout_height="match_parent"
   android:layout_width="match_parent"
  />

您可以使用此选项更改布局高度和宽度,以匹配可用屏幕的父级

或者下面指定dp中的高度和宽度值,更改数字并更改布局的大小

注意:确保布局不在约束布局中


它的出现是因为您的根布局是android.support.constraint.ConstraintLayout 如果要将
match_parent
设置为相对版面的高度和宽度,请转到版面设计页面,并执行以下类似图像的操作:

解决方案2


将您的根布局从android.support.constraint.ConstraintLayout更改为
LinearLayout
或其他
视图组
RelativeLayout

我尝试过,但没有成功。无论如何,谢谢你的帮助