无法将UI元素添加到android视图的底部
我正在尝试在视图中添加滚动视图。所有元素都会根据我的位置正确显示在视图上。我已将LogoutLabel和LogoutButton放置到android:layout\u alignParentBottom=true以将它们附加到视图底部。但我的问题是,当我将滚动视图添加到视图时,LogoutLabel和LogoutButton会更改其位置并进入视图的中间部分,即不保留在底部。我希望它们位于视图的底部,并在视图上启用滚动 请任何人都有解决这个问题的办法 谢谢无法将UI元素添加到android视图的底部,android,Android,我正在尝试在视图中添加滚动视图。所有元素都会根据我的位置正确显示在视图上。我已将LogoutLabel和LogoutButton放置到android:layout\u alignParentBottom=true以将它们附加到视图底部。但我的问题是,当我将滚动视图添加到视图时,LogoutLabel和LogoutButton会更改其位置并进入视图的中间部分,即不保留在底部。我希望它们位于视图的底部,并在视图上启用滚动 请任何人都有解决这个问题的办法 谢谢 <?xml version="1.
<?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>
假设您希望在AccountLabel下方使用logoutLabel和logoutButton,请使用android_LayoutDown=@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"/>
希望这有帮助
-Salil谢谢Salil的回答,但我知道我已经用它垂直对齐了我的所有UI元素,但在我的情况下,我希望这两个textview和button与底部对齐您的意思是这两个控件不应该是scrollView的一部分吗,如果是,则尝试在RelativeLayout中创建另一个LinearLayout,并在那里添加两个控件。不,所有元素都是scrollview的一部分,但我会尝试你的建议,将它们放在另一个布局中。只有当我给它硬编码值(如android:paddingTop=280px)时,它们才起作用粘到底,但我希望它相对粘到底,而不是使用alignParentBottom=true@Kartik:链接不工作。正常。我正在移除它。当我上个月遇到同样的问题时,它正在工作。