在Android RelativeLayout中,maxWidth不';行不通
我在内容中获得了在Android RelativeLayout中,maxWidth不';行不通,android,layout,Android,Layout,我在内容中获得了RelativeLayout: <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" an
RelativeLayout
:
<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"
android:maxWidth="350dp"
></RelativeLayout>
android:maxWidth=“350dp”
不工作。对于layout\u width
的wrap\u content
和layout\u height
两者都不起作用。我意识到maxWidth
参数对于RelativeLayout
不能也不能起作用。但安卓Studio用户界面并未将其视为RelativeLayout
的错误参数Maxwidth
param可用于视图
和ConstraintLayout
,因此在解决方案中,我将使用它将相对定位
添加到ConstraintLayout
。android:layout\u width=“match\u parent”
这意味着您的布局将尽可能宽possible@A.Shevchuk我把它改成了wrap_content
,但它是一样的。@Januszj.,你能澄清一下你的预期结果吗?我刚刚检查了RelativeLayout甚至ViewGroupp的文档,它们不是android:maxWidth的属性。它是按视图而不是全部声明的,因此例如,视图EditText和ContrainLayout都具有该属性。