编写app的一些心得

来源:互联网 发布:亡者归来第三季 知乎 编辑:程序博客网 时间:2024/05/17 17:45

在使用listview这个控件的时候,我们难免遇到这样的问题:

ListView中的项目过多,造成其下方的控件被遮挡。

经过试验,我认为解决方法是:将ListView下方的控件放入线性布局容器中,这样下方的控件就不会被遮挡。

源代码如下

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     tools:context=".FirstPageOfNoteBook" >

    <ListView 
        android:id="@+id/noteList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
       ></ListView>
  
<LinearLayout 
    android:id="@+id/linearlayout1"
    android:layout_width="match_parent"                      
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_alignParentBottom="true"
    >


    <Button 
        android:id="@+id/create"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="create a new note"/>
</LinearLayout>
    

    </RelativeLayout>

当然目测自定义控件也是可行的,但是没有尝试过,欢迎大神指教~大笑

1 0
原创粉丝点击