How to use Scroll View In Android

前端 未结 2 642
盖世英雄少女心
盖世英雄少女心 2020-12-22 14:04

I have use two scroll views for two different layout. And those two layouts are inside a Linear Layout.

Here is my XML file. I don\'t why ScrollView is

2条回答
  •  情歌与酒
    2020-12-22 14:50

    I think you need a simple, two-column organization:

    
    
        
    
        
    
            
        
    
        
    
            
        
    
        
    
    

    Alternatively (and perhaps better) it looks like you should be using two ListView elements instead of two ScrollView elements. Each ListView would have the same layout parameters as shown above for the ScrollView. Since a ListView manages scrolling internally, you then don't need ScrollView at all.

    Also, you probably want the entire layout to fill the screen, with the "filter" and "sort" elements always at the bottom. To achieve this effect,the top-level layout should have android:layout_height="fill_parent" instead of "wrap_content". Also, the scrollable areas should have android:layout_height="0dp" and a non-zero weight (which they already do).

提交回复
热议问题