android自定义view内容显示不全

来源:互联网 发布:java贪吃蛇代码详解 编辑:程序博客网 时间:2024/05/17 09:28

当自定义view中内容过多,导致页面内容无法完全显示时,自己首先考虑到了怎么加入下拉条使用户可以下拉查看余下内容,这样做不知道会增加多少工作量,可能页面大小等需要重新计算,页面中元素各个位置也可能需要重新计算。

后来查到可以使用SCROLLVIEW来自动夸大显示区域。


解决方法是:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >


    <my.topoStructureView
        android:id="@+id/topoStructureView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />


</ScrollView>



原创粉丝点击