Sự cố tôi gặp phải là nếu tôi có chế độ xem (ví dụ: myButton) bên trong RelativeLayout được đặt thành alignParentBottom - (theo mã bên dưới) - và sau đó quấn RelativeLayout bằng scrollview (cần thiết để nội dung có thể xem được trên màn hình nhỏ hơn hoặc khi định hướng thay đổi thành ngang) - khi đó, khi không thể nhìn thấy phía dưới gốc (ví dụ: khi được thay đổi thành hướng ngang) myButton được hiển thị ở đầu trang - KHÔNG ở dưới cùng.Android RelativeLayout: cách alignParentBottom khi được bao bọc trong ScrollView?
Làm cách nào để căn chỉnh chế độ xem ở cuối màn hình và giữ nó ở dưới cùng ngay cả khi phần dưới bên dưới cuộn?
<ScrollView
android:id="@+id/mainScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
... lots of views and stuff
<Button android:layout_alignParentBottom="true"
android:id="@+id/myButton"
android:text="Click Me" />
</RelativeLayout>
</ScrollView>
bạn có biết làm thế nào để làm điều này hôm nay? –