
我试图在屏幕中间设置一个滚动视图,在标题(tablelayout)和页脚(ralativelayout内的按钮)之间….我的问题是,当子项目(edittext和spinners)留在指定区域,滚动条延伸屏幕的整个长度.知道我做错了什么吗?提前致谢.
这是xml:
<?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"> <tableLayout androID:ID="@+ID/tableLayout01" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:stretchColumns="0"> <tableRow androID:ID="@+ID/tableRow01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"> <TextVIEw androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:text="@string/Title" /> <EditText androID:ID="@+ID/Title" androID:layout_height="wrap_content" androID:layout_wIDth="wrap_content" androID:hint="Montague St."/> </tableRow> <tableRow androID:ID="@+ID/tableRow02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"> <TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="@string/body" /> <EditText androID:ID="@+ID/body" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_weight="1" androID:scrollbars="vertical" androID:hint="44"/> </tableRow> </tableLayout><tableRow androID:ID="@+ID/tableRow03" androID:layout_height="wrap_content" androID:layout_wIDth="wrap_content"><TextVIEw androID:ID="@+ID/TextVIEw01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="House Number "></TextVIEw><TextVIEw androID:ID="@+ID/TextVIEw02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Status "></TextVIEw><TextVIEw androID:ID="@+ID/TextVIEw03" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="# of Visits"></TextVIEw></tableRow><ScrollVIEw androID:ID="@+ID/ScrollVIEw01" androID:isScrollContainer="true" androID:layout_wIDth="wrap_content" androID:clipChildren="true" androID:clipTopadding="true" androID:layout_height="wrap_content" androID:layout_marginBottom="50dip"><linearLayout androID:ID="@+ID/linearLayout01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:orIEntation="vertical"><tableLayout androID:ID="@+ID/tableLayout02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:hint="House Number "></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow><tableRow androID:ID="@+ID/tableRow04" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"><EditText androID:ID="@+ID/EditText01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></EditText><Spinner androID:ID="@+ID/Spinner01" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner><Spinner androID:ID="@+ID/Spinner02" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"></Spinner></tableRow></tableLayout></linearLayout></ScrollVIEw><relativeLayout androID:layout_margintop="-50dip" androID:gravity="bottom" androID:layout_height="wrap_content" androID:layout_wIDth="fill_parent"><button androID:ID="@+ID/confirm" androID:text="@string/confirm" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"/> </relativeLayout> </linearLayout>解决方法:
你应该看看androID:layout_weight属性
总结以上是内存溢出为你收集整理的Android布局xml中的Scrollview问题全部内容,希望文章能够帮你解决Android布局xml中的Scrollview问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)