này là ví dụ XMLLàm thế nào để ngăn chặn khác Xem bị đẩy ra khỏi màn hình
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_margin="5dip" android:background="#FF992222">
<ScrollView android:layout_height="wrap_content"
android:layout_width="fill_parent">
<LinearLayout android:layout_height="wrap_content"
android:orientation="vertical" android:layout_width="fill_parent">
<TextView android:layout_width="wrap_content" android:text="TextView"
android:layout_height="wrap_content" android:textSize="24dip"></TextView>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_margin="5dip" android:background="#FF555555">
<TextView android:layout_width="wrap_content" android:text="TextView"
android:layout_height="wrap_content" android:textSize="24dip"></TextView>
</LinearLayout>
</LinearLayout>
Kết quả là như thế này:
Nếu bạn nhận thấy, các văn bản trong LinerLayout trên được gói trong LinearLayout và ScrollView.
Nếu nội dung trên tiếp tục gia tăng, nó sẽ giống như thế này
dưới LinearLayout sẽ được đẩy ra khỏi màn hình trước khi scrollview trở nên năng động và làm cho nội dung đầu tiên trở thành cuộn .... và tôi không muốn điều đó xảy ra được ...
tôi nên làm gì để làm cho scrollview trước Xem đáy bị đẩy ra khỏi màn hình như thế này:
(điều này được chỉnh sửa hình ảnh và không được tạo ra bởi trình biên tập Layout Android)
Hy vọng câu hỏi đủ rõ ràng .. Cảm ơn :)
tại sao không bạn giữ mọi thứ bên trong một scrollview. –
vì vậy bạn không muốn di chuyển chế độ xem văn bản màu xám ở tất cả trong khi những màu đỏ ở lại có thể cuộn am i chính xác? – Urban