ScrollView Properties Fillviewport solve the problem that Android layout can't fill full screen

Source: Internet
Author: User

Ext.: http://blog.sina.com.cn/s/blog_6cf2ea6a0102v61f.html

Development project encountered a problem, the layout height in some domestic cool small screen mobile phone height is not enough to show all, so use ScrollView nested linearlayout, but the problem arises again, in the big screen mobile phone such as Samsung Note3 mobile phone below will remain white, The solution to this problem is to nest multiple linearlayout within the first layer of linearlayout, and most importantly to set Android:fillviewport to true in ScrollView.

When the elements in the ScrollView want to fill ScrollView, using "fill_parent" is not useful and must be set to ScrollView: Android:fillviewport= "true".

When ScrollView does not fillveewport= "true", the elements inside (such as linearlayout) are calculated according to the wrap_content (whether or not it is set to "Fill_parent"), And if the elements of the LinearLayout set fill_parent, then it is no use, because the linearlayout depends on the elements inside, and the elements in the linearlayout, such contradictions. So the inside element is set to Fill_ The parent will also be counted as wrap_content.

ScrollView Properties Fillviewport solve the problem that Android layout can't fill full screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.