Android layout 布局宽度属性
我收到错误“你必须提供一个布局\宽度属性”有什么建议吗?我以为它是第一排的xmlns行,但仍然没有Android layout 布局宽度属性,android-layout,Android Layout,我收到错误“你必须提供一个布局\宽度属性”有什么建议吗?我以为它是第一排的xmlns行,但仍然没有 <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_parent" android:layout_height="wrap_parent" android:layout_gravity="center" android
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_parent"
android:layout_height="wrap_parent"
android:layout_gravity="center"
android:columnCount="2"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4" />
</GridLayout>
使用wrap\u content
而不是不存在的wrap\u parent
使用wrap\u content
而不是不存在的wrap\u parent我认为@martenson是对的,请接受他的答案,如果它解决了你的问题,我认为@martenson是对的,如果它解决了你的问题,请接受他的答案