6

Tôi đang sử dụng NestedScrollView trong đoạn của mình. Trong xml của tôi bên trong một RelativeLayout nhưng nó không bao gồm chiều cao đầy đủ của màn hình.Trẻ em bên trong NestedScrollView không che hết chiều cao của màn hình

Dưới đây là mã của tôi -

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:fitsSystemWindows="true" 
android:background="@color/black" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<RelativeLayout 
    android:background="@color/red_error_color" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


</RelativeLayout> 
</android.support.v4.widget.NestedScrollView> 

khi chạy mã chỉ nền đen có thể nhìn thấy nhưng không phải màu đỏ làm nền xem con tôi là màu đỏ.

Cảm ơn trước

Trả lời

22

Cố gắng thêm dòng mã này trên nestedscrollview bạn

android:fillViewport="true" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 

Remove:

android:fitsSystemWindows="true" 
+1

Nhờ công việc của mình cho tôi. Tôi đã cố gắng để thêm vào dòng trên nhưng nó không phải trong đề nghị trong khi gõ: (lỗi của tôi – Ravi

+0

Chào mừng bạn bro .... –

+2

Tôi giả sử trong một trường hợp tổng quát hơn android: fillViewport = "true" là đủ. (Làm việc cho tôi) – Stan

Các vấn đề liên quan