我正在使用gridLayout来简单地显示2x2布局。我会在稍后增加这个,但我只是想让样本工作。截至目前,他们排成一排。通过只看我的XML,有没有人看到任何明显的,我做错了什么?我的代码编译,我的XML“验证”。由于GridLayout将不会显示在网格中
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:grid="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res/com.test.example"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<android.support.v7.widget.GridLayout
android:id="@+id/GridLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:columnCount="2"
android:rowCount="2" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</android.support.v7.widget.GridLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
</RelativeLayout>
嗯......不要以为这是''的用途。它们只指定一个空格,并且在editText和一个按钮之间。我从这个教程中拿出了我的例子:https://www.youtube.com/watch?v=TaCW4uL4P6c 2:54 –
EGHDK
“不要以为这就是''是为了”我不明白你的意思这样。 –
对不起,无视。我以为我在''中只有一次出现'android:layout_column =“0”'。 –
EGHDK