解决方案 »

  1.   

    给这个listview添加footview啊。listView.addFootView();
      

  2.   

    直接在布局文件上改啊,  把 ViewPager 放在 LinearLayout 里面, 在 ViewPager 控件下面放一个 TextView 啊
      

  3.   

    既然你listview高度写死了 , 在下面加个textview不就可以了吗。。这个应该很简单吧,还是我理解的有问题?
      

  4.   

    你textview是要加在listview下面,还是ViewPager 下面?
      

  5.   

    只用用Relativelayout,在textview放在底部,listview在他的上边
      

  6.   

    可能我表达有误,我只是想单独在第二个页面中添加这样的TextView。
      

  7.   

    这样的布局之后,那我再MainActivity中怎么添加这个view呢。是不是需要先定义一个类,然后将我需要的view绘制出来,返回,然后在上述代码中调用viewpager的add方法添加这个view?
      

  8.   

    请教,下面和上面有什么区别?是不是如果在下面,有能够直接使用的api。我主要就是想实现滑动listview的时候,这个textview保持不动。
      

  9.   

    请教,下面和上面有什么区别?是不是如果在下面,有能够直接使用的api。我主要就是想实现滑动listview的时候,这个textview保持不动。
    如果是在listview下加,就使用listView的addFooterView方法,如果是layout下的话,使用<include layout="@layout/footer" />,根据你的需求,应该使用后者。
      

  10.   

    请教,下面和上面有什么区别?是不是如果在下面,有能够直接使用的api。我主要就是想实现滑动listview的时候,这个textview保持不动。
    如果是在listview下加,就使用listView的addFooterView方法,如果是layout下的话,使用<include layout="@layout/footer" />,根据你的需求,应该使用后者。
    试了一下貌似还不行。<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        
        <ListView 
            android:id="@+id/page2_list"
            android:layout_height="50dip"
            android:layout_width="fill_parent"
            android:background="#EDEDED"
            ></ListView>
        
        <include layout="@layout/pager2_foot"/>
        
    </LinearLayout>
      

  11.   

    请教,下面和上面有什么区别?是不是如果在下面,有能够直接使用的api。我主要就是想实现滑动listview的时候,这个textview保持不动。
    如果是在listview下加,就使用listView的addFooterView方法,如果是layout下的话,使用<include layout="@layout/footer" />,根据你的需求,应该使用后者。
    试了一下貌似还不行。<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        
        <ListView 
            android:id="@+id/page2_list"
            android:layout_height="50dip"
            android:layout_width="fill_parent"
            android:background="#EDEDED"
            ></ListView>
        
        <include layout="@layout/pager2_foot"/>
        
    </LinearLayout>
    将LinearLayout 改为RelativeLayout
      

  12.   

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >    <ListView
            android:id="@+id/page2_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#EDEDED" >
        </ListView>    <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:gravity="center" /></FrameLayout>
      

  13.   

    请教,下面和上面有什么区别?是不是如果在下面,有能够直接使用的api。我主要就是想实现滑动listview的时候,这个textview保持不动。
    如果是在listview下加,就使用listView的addFooterView方法,如果是layout下的话,使用<include layout="@layout/footer" />,根据你的需求,应该使用后者。
    试了一下貌似还不行。<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        
        <ListView 
            android:id="@+id/page2_list"
            android:layout_height="50dip"
            android:layout_width="fill_parent"
            android:background="#EDEDED"
            ></ListView>
        
        <include layout="@layout/pager2_foot"/>
        
    </LinearLayout>
    将LinearLayout 改为RelativeLayout
    除此以外,我还需要在MainActivity中做怎样的修改,现在,我viewpager中第二页直接使用的是ListView,代码如上,该如何修改?谢谢指导。
      

  14.   

    将listview和textview分开来看,各自负责显示,只是在一个layout里面定义而已
      

  15.   

    有个demo就好了。谢谢。
    少年,你把LinearLayout换成FrameLayout 就可以了,12L