我有以下的示例XML佈局,從here採取(移除了一些不重要的部分):爲什麼'layout_column'不會將元素放置在GridLayout中?
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:useDefaultMargins="true"
android:alignmentMode="alignBounds"
android:columnOrderPreserved="true"
android:columnCount="4"
>
<TextView
android:text="Email setup"
android:textSize="32dip"
android:layout_columnSpan="4"
android:layout_gravity="center_horizontal"
/>
<TextView
android:text="Email address:"
android:layout_gravity="right"
/>
<EditText
android:ems="10"
/>
<TextView
android:text="Password:"
android:layout_column="0"
android:layout_gravity="right"
/>
<EditText
android:ems="8"
/>
<Space
android:layout_row="4"
android:layout_column="0"
android:layout_columnSpan="4"
android:layout_gravity="fill"
/>
<Button
android:text="Next"
android:layout_row="5"
android:layout_column="2"
/>
</GridLayout>
我改變爲android:layout_column
參數爲「Next'按鈕中的最後一行的3至2,但是這並不能改變它的佈局位置:
在我的網格佈局我有幾個列的認識,並且參數layout_column
指定其中的元素放置列。但這似乎並不奏效。元素的位置不會改變。
我見。第一個EditText框定義了第2列(或第3列的左側位置)的正確位置,它將文本框放在屏幕的某個「外面」? – Alex
準確編輯文本框定義了屏幕外部按鈕的起始位置,因爲所有文本框都可見。但我認爲你明白了。 –
是的,我想我今天學到了一些東西。非常感謝你! – Alex