android–scrollview with floating linearlayout不会滚动

android–scrollview with floating linearlayout不会滚动,第1张

概述这是我的guixml:<FrameLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:id="@+id/frameLayout"xmlns:android="http://schemas.android.com/apkes/android"><Scrol

这是我的gui xml:

<FrameLayout androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent" androID:ID="@+ID/frameLayout"    xmlns:androID="http://schemas.androID.com/apk/res/androID">    <ScrollVIEw androID:layout_wIDth="fill_parent" androID:ID="@+ID/scrollVIEw"        androID:fillVIEwport="true" androID:layout_height="fill_parent">        <linearLayout androID:layout_wIDth="fill_parent"            androID:orIEntation="vertical" androID:ID="@+ID/contentLayout"            androID:padding="5dip" androID:fadingEdge="vertical"            androID:layout_height="fill_parent">            <TextVIEw androID:ID="@+ID/lblname" androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:text="@string/label_name"></TextVIEw>            <linearLayout androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:ID="@+ID/nameLayout">                <CheckBox androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content" androID:ID="@+ID/chkname"></CheckBox>                <TextVIEw androID:layout_marginleft="4dip"                    androID:layout_marginRight="4dip" androID:ID="@+ID/txtname"                    androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content"                    androID:textcolor="@color/white" androID:text="TextVIEw"                    androID:layout_weight="1" androID:textSize="20dip"></TextVIEw>            </linearLayout>            <TextVIEw androID:ID="@+ID/lblPhone" androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:text="@string/label_phone"></TextVIEw>            <linearLayout androID:isScrollContainer="false"                androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content"                androID:orIEntation="vertical" androID:ID="@+ID/lstPhone"></linearLayout>            <TextVIEw androID:ID="@+ID/lblEmail" androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:text="@string/label_email"></TextVIEw>            <linearLayout androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:orIEntation="vertical"                androID:ID="@+ID/lstemail"></linearLayout>            <TextVIEw androID:ID="@+ID/lblAddress" androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:text="@string/label_address"></TextVIEw>            <linearLayout androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content" androID:orIEntation="vertical"                androID:ID="@+ID/lstAddress"></linearLayout>        </linearLayout>    </ScrollVIEw>    <linearLayout androID:background="@color/grey"        androID:layout_wIDth="fill_parent" androID:paddingtop="5dip"        androID:layout_height="wrap_content" androID:orIEntation="horizontal"        androID:layout_gravity="bottom|right" androID:ID="@+ID/commandLayout">        <button androID:ID="@+ID/btnToClipBoard" androID:layout_wIDth="fill_parent"            androID:layout_height="fill_parent" androID:text="To ClipBoard"            androID:layout_weight="1"></button>        <button androID:ID="@+ID/btnCancel" androID:layout_wIDth="fill_parent"            androID:layout_height="fill_parent" androID:text="Cancel"            androID:layout_weight="1"></button>    </linearLayout></FrameLayout>

linearLayout ID:commandLayout很好地保留在窗口的底部.但是linearLayout ID:contentLayout不会滚动.如果我在scrollVIEw中移动commandLayout,那么所有内容都会滚动.这不是我想要的.无论contentLayout有多长,我都希望看到按钮.任何帮助将不胜感激.我大部分时间都在这上面…谢谢.

编辑:感谢您的所有回复.从FrameLayout更改为relativeLayout并设置commandLayout对齐父底部和scrollvIEw对齐父顶部是最有效的解决方案.

解决方法:

我将基本布局即“frameLayout”更改为相对布局.

我这样做,以便“commandLayout”将低于“scrollVIEw”.
如果您要显示的内容隐藏在“commandLayout”后面,这没有意义

我在“commandLayout”上添加了alignParentBottom.
我还在“scrollVIEw”中添加了layout_above =“@ ID / commandLayout”

这是工作的xml,是的,它滚动=)

<relativeLayoutandroID:layout_wIDth="fill_parent"androID:layout_height="fill_parent"androID:ID="@+ID/relativeLayout"xmlns:androID="http://schemas.androID.com/apk/res/androID"><ScrollVIEw     androID:layout_wIDth="fill_parent"    androID:ID="@+ID/scrollVIEw"    androID:fillVIEwport="true"    androID:layout_height="fill_parent"    androID:layout_above="@+ID/commandLayout">    <linearLayout         androID:layout_wIDth="fill_parent"        androID:orIEntation="vertical"        androID:ID="@+ID/contentLayout"        androID:padding="5dip"        androID:fadingEdge="vertical"        androID:layout_height="fill_parent"    >        <TextVIEw            androID:ID="@+ID/lblname"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"        >        </TextVIEw>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:ID="@+ID/nameLayout"        >            <CheckBox                 androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:ID="@+ID/chkname">            </CheckBox>            <TextVIEw                androID:layout_marginleft="4dip"                androID:layout_marginRight="4dip"                androID:ID="@+ID/txtname"                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:textcolor="#FFFFFF"                androID:text="TextVIEw"                androID:layout_weight="1"                androID:textSize="20dip">            </TextVIEw>        </linearLayout>        <TextVIEw            androID:ID="@+ID/lblPhone"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"        >        </TextVIEw>        <linearLayout            androID:isScrollContainer="false"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:orIEntation="vertical"            androID:ID="@+ID/lstPhone">        </linearLayout>        <TextVIEw            androID:ID="@+ID/lblEmail"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"        >        </TextVIEw>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:orIEntation="vertical"            androID:ID="@+ID/lstemail"        >        </linearLayout>        <TextVIEw            androID:ID="@+ID/lblAddress"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"        >        </TextVIEw>        <linearLayout            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:orIEntation="vertical"            androID:ID="@+ID/lstAddress">        </linearLayout>        <TextVIEw            androID:ID="@+ID/LongText"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:textSize="40sp"            androID:text="This is a super long text that will hopefully cover the whole screen so as the scroll will work."        >        </TextVIEw>         <TextVIEw            androID:ID="@+ID/AnotherLongText"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:textSize="40sp"            androID:text="This is another super long text to show that the scrolling will work even more!"        >        </TextVIEw>    </linearLayout></ScrollVIEw><linearLayout    androID:background="#737754"    androID:layout_wIDth="fill_parent"    androID:paddingtop="5dip"    androID:layout_height="wrap_content"    androID:orIEntation="horizontal"    androID:ID="@+ID/commandLayout"    androID:layout_alignParentBottom="true">    <button        androID:ID="@+ID/btnToClipBoard"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:text="To ClipBoard"        androID:layout_weight="1">    </button>    <button        androID:ID="@+ID/btnCancel"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:text="Cancel"        androID:layout_weight="1">    </button></linearLayout></relativeLayout>
总结

以上是内存溢出为你收集整理的android – scrollview with floating linearlayout不会滚动全部内容,希望文章能够帮你解决android – scrollview with floating linearlayout不会滚动所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1117582.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存