为什么android studio designer不适用于相对布局
不是为相对布局自动生成XML代码,它仅适用于约束布局 当我试图在相对布局中定位视图时,它只定位在屏幕的上角为什么android studio designer不适用于相对布局,android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,不是为相对布局自动生成XML代码,它仅适用于约束布局 当我试图在相对布局中定位视图时,它只定位在屏幕的上角 <?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" xmlns:tools="
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</RelativeLayout
是的,如果您在ConstraintLayout上拖动组件,它将猜测您想要什么并为您设置属性。
对于RelativeLayout,需要使属性视图可见并从中进行编辑。您需要编辑如下参数:
android:layout_below="@id/name"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/times"
我面对同样的问题,我尝试了以下步骤
- 单击磁铁图标(眼睛图标旁边,左上角,调色板菜单旁边),这样它就不会被划掉:这将打开自动连接
- 现在,这将帮助您将按钮移动到您想要放置它的任何位置
试试看,让我知道。你知道什么是亲戚吗?如果没有,我建议先读一下,也许这会有帮助,或者在官方网页上,你到底想要什么?要将按钮显示到中间位置吗?是的,这就是我想要的。我以前在android studio的早期版本中也能做到这一点,但在更新android studio之后,它就不起作用了。您如何设置按钮的位置?要设置位置,需要定义它与其他视图(如parent.android studio 3.4 xml设计视图约束无效)之间的关系。为什么?