android:layout_alignparentbottom,Android: layout_below and layout_alignParentBottom

吴刚毅
2023-12-01

So I have the following layout

ScrollView

RelativeLayout

TextView1

EditText1

TextView2

EditText2

TextView3

EditText3

TextView4

EditText4

TextView5

EditText5:

android:id="@+id/txtPassword"

LinearLayout:

android:id="@+id/Linearlayout1"

layout_alignParentBottom="true"

Button1

Button2

Here's the problem

When I click the txtPassword EditText to enter some text Button1&Button2 from the LinearLayout overlaps or becomes on top of txtPassword

Someone suggested that I use android:layout_below="@id/txtPassword" for the Linear Layout but that makes the layout_alignParentBottom="true" useless because it will put the LinearLayout right below txtPassword and not at the bottom.

EDIT: Here's the Full Layout

android:id="@+id/signatureScroller"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:fillViewport="true" >

android:id="@+id/signatureLayout"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#FFF"

android:orientation="vertical"

android:paddingBottom="20dp"

android:paddingLeft="10dp"

android:paddingRight="10dp" >

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_alignParentTop="true"

android:layout_marginTop="20dp"

android:text="@string/Meaning"

android:textColor="#000"

android:textSize="14sp" />

android:id="@+id/txtMeaning"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/textView1"

android:layout_below="@+id/textView1"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="16dp"

android:ems="10"

android:enabled="false"

android:inputType="text|textMultiLine"

android:singleLine="true"

android:textColor="#505050"

android:textSize="14sp" >

android:id="@+id/TextView01"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/textView1"

android:layout_below="@+id/txtMeaning"

android:layout_marginTop="16dp"

android:text="@string/Comments"

android:textColor="#000"

android:textSize="14sp" />

android:id="@+id/txtSignatureComments"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/TextView01"

android:layout_below="@+id/TextView01"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="16dp"

android:ems="10"

android:hint="@string/Comments"

android:inputType="textMultiLine"

android:maxLength="250"

android:singleLine="false"

android:textSize="14sp" />

android:id="@+id/imageView1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/textView1"

android:layout_below="@+id/textView1"

android:layout_marginTop="4dp"

android:contentDescription="@string/Image"

android:scaleType="fitXY"

android:src="@drawable/line2" />

android:id="@+id/ImageView01"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/TextView01"

android:layout_below="@+id/TextView01"

android:layout_marginTop="4dp"

android:contentDescription="@string/Image"

android:scaleType="fitXY"

android:src="@drawable/line2" />

android:id="@+id/txtDuration"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtSignatureComments"

android:layout_marginTop="16dp"

android:text="@string/Duration2"

android:textColor="#000"

android:textSize="14sp" />

android:id="@+id/imgDuration"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtDuration"

android:layout_marginTop="4dp"

android:contentDescription="@string/Image"

android:scaleType="fitXY"

android:src="@drawable/line2" />

android:id="@+id/txtHours"

android:layout_width="140dp"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/imgDuration"

android:layout_marginLeft="6dp"

android:layout_marginTop="16dp"

android:ems="10"

android:hint="@string/Hours"

android:inputType="number|textMultiLine"

android:singleLine="true"

android:textColor="#505050"

android:textSize="14sp" >

android:id="@+id/txtMinutes"

android:layout_width="140dp"

android:layout_height="wrap_content"

android:layout_alignBaseline="@+id/txtHours"

android:layout_alignParentRight="true"

android:layout_marginRight="6dp"

android:ems="10"

android:hint="@string/Minutes"

android:inputType="numberDecimal|text|textMultiLine"

android:singleLine="true"

android:textColor="#505050"

android:textSize="14sp" >

android:id="@+id/txtException"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtHours"

android:layout_marginTop="16dp"

android:text="@string/Exception"

android:textColor="#000"

android:textSize="14sp" />

android:id="@+id/imgException"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtException"

android:layout_marginTop="4dp"

android:contentDescription="@string/Image"

android:scaleType="fitXY"

android:src="@drawable/line2" />

android:id="@+id/spnrException"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_below="@+id/imgException"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="16dp" />

android:id="@+id/txtExceptionDesc"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/spnrException"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="8dp"

android:ems="10"

android:inputType="textMultiLine"

android:maxLength="250"

android:singleLine="false"

android:textSize="14sp" >

android:id="@+id/txtPerformance"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtExceptionDesc"

android:layout_marginTop="16dp"

android:text="@string/PerformanceBased"

android:textColor="#000"

android:textSize="14sp" />

android:id="@+id/imgPerformance"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtPerformance"

android:layout_marginTop="4dp"

android:contentDescription="@string/Image"

android:scaleType="fitXY"

android:src="@drawable/line2" />

android:id="@+id/spnrPerformance"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/imgPerformance"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="16dp" />

android:id="@+id/txtUsername"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/spnrPerformance"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="60dp"

android:ems="10"

android:hint="@string/Username"

android:inputType="textCapCharacters|textAutoComplete"

android:singleLine="true"

android:textAllCaps="true"

android:textSize="12sp" >

android:id="@+id/txtPassword"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/txtUsername"

android:layout_marginLeft="6dp"

android:layout_marginRight="6dp"

android:layout_marginTop="10dp"

android:ems="10"

android:hint="@string/Password"

android:inputType="textPassword"

android:singleLine="true"

android:textSize="12sp" />

android:id="@+id/LinearLayout1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true" >

android:id="@+id/btnSave"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:background="@drawable/button_detail_bg"

android:text="@string/Sign"

android:textColor="@drawable/button_detail_txt"

android:textSize="16sp"

android:textStyle="bold" />

android:id="@+id/btnCancel"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:background="@drawable/button_detail_bg"

android:text="@string/Cancel"

android:textColor="@drawable/button_detail_txt"

android:textSize="16sp"

android:textStyle="bold" />

 类似资料:

相关阅读

相关文章

相关问答