我是Android开发的新手,所以我可能错过了一个简单的问题,但我正在尝试创建一个顶部有图像的登录屏幕。我的布局完全符合我的要求,除非我添加图像时整个布局发生变化。我添加了一个与imageview(LoginPageCharity)具有相同网格设置的文本框进行测试,它与文本框完美配合,但随后我将imageview更改为visible,文本框(textView1)消失,我的整个设置发生了变化。你能解释一下为什么会这样,如果可能的话如何解决这个问题?先感谢您!这是两个布局和我的代码。
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:id="@+id/gridLayout1"
p1:columnCount="6"
p1:rowCount="10"
p1:alignmentMode="alignBounds"
p1:orientation="horizontal"
p1:columnOrderPreserved="true"
p1:rowOrderPreserved="true"
p1:useDefaultMargins="false">
<TextView
p1:id="@+id/textView1"
p1:enabled="true"
p1:visibility="visible"
p1:layout_column="0"
p1:layout_columnSpan="6"
p1:layout_columnWeight="6"
p1:layout_row="0"
p1:layout_rowSpan="3"
p1:layout_rowWeight="3" />
<TextView
p1:id="@+id/textView2"
p1:layout_column="0"
p1:layout_columnSpan="1"
p1:layout_columnWeight="1"
p1:layout_row="5"
p1:layout_rowSpan="1"
p1:layout_rowWeight="0.3"
p1:visibility="visible" />
<Button
p1:text="Log In"
p1:id="@+id/button1"
p1:layout_column="1"
p1:layout_columnSpan="1"
p1:layout_columnWeight="1"
p1:layout_row="5"
p1:layout_rowSpan="1"
p1:layout_rowWeight="0.3" />
<TextView
p1:id="@+id/textView3"
p1:layout_column="2"
p1:layout_columnSpan="1"
p1:layout_columnWeight="1"
p1:layout_row="5"
p1:layout_rowSpan="1"
p1:layout_rowWeight="0.3" />
<Button
p1:text="Create Account"
p1:id="@+id/button2"
p1:layout_column="4"
p1:layout_columnSpan="1"
p1:layout_columnWeight="1"
p1:layout_row="5"
p1:layout_rowSpan="1"
p1:layout_rowWeight="0.3" />
<TextView
p1:id="@+id/textView4"
p1:layout_column="5"
p1:layout_columnSpan="1"
p1:layout_columnWeight="1"
p1:layout_row="5"
p1:layout_rowSpan="1"
p1:layout_rowWeight="0.3" />
<TextView
p1:id="@+id/textView5"
p1:layout_column="0"
p1:layout_columnSpan="6"
p1:layout_columnWeight="6"
p1:layout_row="6"
p1:layout_rowSpan="4"
p1:layout_rowWeight="4" />
<EditText
p1:inputType="textPassword"
p1:id="@+id/editText1"
p1:layout_column="1"
p1:layout_columnSpan="4"
p1:layout_columnWeight="4"
p1:layout_row="4"
p1:layout_rowSpan="1"
p1:text="Password" />
<EditText
p1:inputType="textEmailAddress"
p1:id="@+id/editText2"
p1:layout_column="1"
p1:layout_columnSpan="4"
p1:layout_columnWeight="4"
p1:layout_row="3"
p1:layout_rowSpan="1"
p1:text="Username" />
<ImageView
p1:src="@drawable/redcross2"
p1:id="@+id/LoginPageCharity"
p1:layout_column="0"
p1:layout_columnSpan="6"
p1:layout_columnWeight="6"
p1:layout_row="0"
p1:layout_rowSpan="3"
p1:layout_rowWeight="3"
p1:scaleType="centerInside"
p1:adjustViewBounds="true"
p1:visibility="gone"
p1:cropToPadding="true" />
</GridLayout>