如下图所示,原本是用的偶然发现的如下代码实现的,后发现在2.1版本(也可能包括更低)不能正常显示,不知道应该用什么布局可以实现:
<ScrollView android:layout_width="fill_parent" android:id="@+id/scrollview"  android:layout_height="fill_parent"
android:layout_weight="1"
android:fastScrollEnabled="true"
android:focusable="true" 
>
<com.xxx.MyView
android:id="@+id/myview"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/>
</ScrollView>
好像起神奇作用的是android:layout_weight="1",原理不知,可惜在2.1里不正常。
回答问题要查资料?用《Csdn收音机》可以最快速度搞定!Csdn好帮手——《Csdn收音机》即使监视社区动态!

解决方案 »

  1.   

    沙发自己抢,肥水不留外人田!如果有话,就更贴对我说吧。我用《Csdn收音机》能听到哦!
      

  2.   

    android:layout_weight="1"就是占1份的比例,如果其他控件没有设置此参数,那就占满所有能占的空间。
    你可以用RelativeLyaout试试,把下面的控件设置成在RelativeLyaout的bottom位置显示。
      

  3.   

    RelativeLyaout和Linearlayout的各种组合几乎都试了,没弄成。TableLayout简单试了下,没看到理想的结果。我想请教一下有没有弄过的,如果有已经证实可用的就最好了,自己一点点试各种组合、反复修改运行,实在很累,而且有时候Eclipse还不得不先对Project进行Clear才会看到改变的效果。《Csdn收音机》是个开源的辅助工具,以后学技术更方便了!
      

  4.   

    1. 先把adt升级到112. 使用RelativeLyaout让子控件的android:layout_alignParentBottom="true"
      

  5.   

    o.ADT 11好像才发布啊,竟有与此有关的更新?这么巧?我正在下载,一会儿看下结果。刚在r10下试了RelativeLayout+android:layout_weight+,不行。升级了也还是不行:回答问题要查资料?用《Csdn收音机》可以最快速度搞定!
      

  6.   

    相同的代码,在2.2上表现甚不一样(虽然也不是所希望的),但足以看出区别之大:实现代码如下:<?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">
      <SeekBar android:id="@+id/seekbar" android:max="100" android:layout_width="fill_parent"  android:layout_height="wrap_content"/>
    <RelativeLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
    <ScrollView android:layout_width="fill_parent" android:id="@+id/scrollview"  android:layout_height="fill_parent"
    android:layout_weight="1"
    android:fastScrollEnabled="true"
    android:background="#220000"
    android:focusable="true">
    <com.xxx.MyView
    android:id="@+id/myview"
        android:layout_width="fill_parent" 
    android:background="#123321"
        android:layout_height="fill_parent"/>
    </ScrollView>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content"
          android:layout_alignParentBottom="true"
      android:orientation="vertical"
      android:layout_height="wrap_content">
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    <Spinner android:id="@+id/encodes" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
       <Button android:text="更多.." android:id="@+id/more" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
       <Button android:text="旧版" android:id="@+id/oldver" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    </LinearLayout>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    <Button android:id="@+id/prevfile" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="上" />
       <Button android:text="下个" android:id="@+id/nextfile" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:id="@+id/prevpage" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="上" /><Button android:id="@+id/nextpage" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="下页" />
    <Button android:id="@+id/btn_prevline" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="上" /><Button android:id="@+id/btn_nextline" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="下行" />
      
       <Button android:text="Go!" android:id="@+id/speak" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    </LinearLayout>
    </LinearLayout>
    </RelativeLayout>
    </LinearLayout>
    还在苦苦刷新页面等待回复吗?用《Csdn收音机》告别烦恼!
      

  7.   

    去掉中间开始、到结束的RelativeLayout以后就很完美了,可惜不支持2.1:我正在使用《Csdn收音机》第一时间获取最新动态!
      

  8.   

    用TableLayout,如下所示: <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
     android:id="@+id/tableLayout1" >
    <TableRow android:id="@+id/tableRow2" android:layout_width="fill_parent"
     android:layout_height="fill_parent" android:layout_weight="1">
    <ScrollView android:layout_width="fill_parent" android:id="@+id/scrollview"  android:layout_height="fill_parent"
    android:layout_weight="1"
    android:fastScrollEnabled="true"
    android:focusable="true">
    <MyView android:id="@+id/myview"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"/>
    </ScrollView>
    </TableRow>
    <TableRow android:id="@+id/tableRow3" android:layout_width="fill_parent" android:layout_height="wrap_content">
    <LinearLayoutblah,blah,blah...