飞道的博客

安卓中ScrollView里面的布局不能撑满整个ScrollView

323人阅读  评论(0)

我有个布局,


  
  1. <?xml version= "1.0" encoding= "utf-8"?>
  2. <ScrollView xmlns:android= "http://schemas.android.com/apk/res/android"
  3. android:layout_width= "match_parent"
  4. android:layout_height= "match_parent"
  5. android:background= "@color/red">
  6. <RelativeLayout
  7. android:layout_width= "match_parent"
  8. android:background= "@color/black"
  9. android:layout_height= "match_parent">
  10. <ImageView
  11. android:id= "@+id/Ic_background"
  12. android:layout_width= "match_parent"
  13. android:layout_height= "wrap_content"
  14. android:src= "@mipmap/ic_background" />
  15. <EditText
  16. android:id= "@+id/PasswordEdit"
  17. android:layout_width= "match_parent"
  18. android:layout_height= "@dimen/x50"
  19. android:layout_below= "@+id/Ic_background"
  20. android:layout_margin= "@dimen/x10"
  21. android:background= "@drawable/password_back"
  22. android:hint= "密码"
  23. android:inputType= "textPassword"
  24. android:padding= "@dimen/x10"
  25. android:textColor= "@color/black"
  26. android:textColorHint= "@color/dimgray"
  27. android:textSize= "@dimen/x20" />
  28. <LinearLayout
  29. android:layout_width= "match_parent"
  30. android:layout_height= "wrap_content"
  31. android:layout_below= "@+id/PasswordEdit"
  32. android:layout_margin= "@dimen/x10"
  33. android:orientation= "horizontal">
  34. <Button
  35. android:id= "@+id/OnbackBton"
  36. android:layout_width= "wrap_content"
  37. android:layout_height= "wrap_content"
  38. android:background= "@mipmap/button"
  39. android:paddingLeft= "@dimen/x35"
  40. android:paddingTop= "@dimen/x10"
  41. android:paddingRight= "@dimen/x35"
  42. android:paddingBottom= "@dimen/x10"
  43. android:text= "返回"
  44. android:textColor= "@color/white"
  45. android:textSize= "@dimen/x15" />
  46. <View
  47. android:layout_width= "0dp"
  48. android:layout_height= "match_parent"
  49. android:layout_weight= "1" />
  50. <Button
  51. android:id= "@+id/SubmitBton"
  52. android:layout_width= "wrap_content"
  53. android:layout_height= "wrap_content"
  54. android:background= "@mipmap/button"
  55. android:paddingLeft= "@dimen/x35"
  56. android:paddingTop= "@dimen/x10"
  57. android:paddingRight= "@dimen/x35"
  58. android:paddingBottom= "@dimen/x10"
  59. android:text= "确认"
  60. android:textColor= "@color/white"
  61. android:textSize= "@dimen/x15" />
  62. < /LinearLayout>
  63. <com.sunchip.vendingmachine.view.BottomStatusBarView
  64. android:layout_width="match_parent"
  65. android:layout_height="wrap_content"
  66. android:layout_alignParentBottom="true" />
  67. < /RelativeLayout>
  68. </ScrollView>

 

看内容,ScrollView里面的RelativeLayout的布局应该是满的,但是实际上,底部的那个自定义view,没有占满底部的位置,如:

一看就没满屏,解决方案====================

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

 在ScrollView的布局加上这句话 :android:fillViewport="true" 就能解决

 


转载:https://blog.csdn.net/qq_36333309/article/details/110656213
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场