开发者

unable to add UI elements to bottom of android view

开发者 https://www.devze.com 2023-02-23 14:36 出处:网络
i am trying to add a scroll view in my view.All the elements show up on view properly according to my placing.i have placed \"LogoutLabel\" and \"LogoutButton\" to android:layout_alignPar开发者_如何学

i am trying to add a scroll view in my view.All the elements show up on view properly according to my placing.i have placed "LogoutLabel" and "LogoutButton" to android:layout_alignPar开发者_如何学JAVAentBottom = "true" to attach them to bottom of view.But my problem is that when i add scrollview to my view "LogoutLabel" and "LogoutButton" changes its positon and comes in middle of view i.e does not remain at bottom.i want them to be at the bottom of the view with scrolling enabled on the view.

Please anyone have solution for this.

Thanks

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent">


<TextView android:id="@+id/SettingsLabel"/>

<TextView android:id="@+id/ProfileLabel"/>

<Button android:id="@+id/EditButton"/>


<TextView android:id="@+id/MyIdLabel"/>

<TextView android:id="@+id/idLabel"/>

<TextView android:id="@+id/EmailIdLabel"/>

<TextView android:id="@+id/emailLabel"/>

<TextView android:id="@+id/PasswordIdLabel"/>

<TextView android:id="@+id/passwordLabel"/>

<TextView android:id="@+id/AccountLabel" />

<TextView 
android:id="@+id/LogoutLabel"
android:layout_width="200sp" 
android:layout_height="wrap_content" 
android:text="Do not want to Logout?"
android:layout_alignParentBottom = "true"
android:textColor = "#000000"
android:paddingLeft = "10px"/>

<Button 
android:id="@+id/LogoutButton" 
android:layout_height="wrap_content" 
android:text="Logout" 
android:layout_alignBaseline = "@id/LogoutLabel"
android:layout_alignParentRight = "true" 
android:layout_alignParentBottom = "true"
android:layout_width="100sp"/>

</RelativeLayout>


Assuming you want the logoutLabel and logoutButton below the AccountLabel use android_layoutBelow="@id/AccountLabel"

    <TextView 
android:id="@+id/LogoutLabel"
android:layout_width="200sp" 
android:layout_height="wrap_content" 
android:text="Do not want to Logout?"
android:layout_alignParentBottom = "true"
android:textColor = "#000000"
android:paddingLeft = "10px"
android:layout_below="@id/AccountLabel"/> 

<Button 
android:id="@+id/LogoutButton" 
android:layout_below="@id/AccountLabel"
android:layout_height="wrap_content" 
android:text="Logout" 
android:layout_alignBaseline = "@id/LogoutLabel"
android:layout_alignParentRight = "true" 
android:layout_alignParentBottom = "true"
android:layout_width="100sp"/>

Hope this helps.

-Salil

0

精彩评论

暂无评论...
验证码 换一张
取 消