安卓:我如何得到一个ListView停止治疗页脚列表中的一个元素? [英] Android: How do I get a listview to stop treating a footer as an element in the list?

查看:156
本文介绍了安卓:我如何得到一个ListView停止治疗页脚列表中的一个元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一些文本和显示的列表视图正下方(其中有一个自定义适配器)在我的活动有一定的按钮。如果东西,在列表中的号码变得太大就应该坐在而在顶部的列表视图滚动屏幕的底部。

I'm trying to have some text and some buttons that appears right beneath the listview (which has a custom adapter) in my activity. If the number of things in the list gets too big then it should sit on the bottom of the screen while the list view scrolls on top.

有人建议我做一个观点出来,并把它作为一个注脚,但是当我这样做只是把页脚为在ListView一行,并与一切滚动。这里是我的code

Someone suggested I make a view out of it and put it as a footer but when I do it just treats the footer as a line in the listview and it scrolls with everything else. Here is my code

View footer = getLayoutInflater().inflate(R.layout.transaction_detail_footer, null);

    TextView t=(TextView)footer.findViewById(R.id.total); 
    t.setText("Total: 558");

    t= (TextView) footer.findViewById(R.id.funds);
    t.setText("Funds: 9800");

    getListView().addFooterView(footer);

    setListAdapter(new TransactionAdapter(TestLV.this,Vs,Vs));

在哪里VS是一个字符串数组。

Where Vs is a string array.

有谁知道如何得到它的工作?

Does anyone know how to get it to work?

推荐答案

这是一个为的ListView 正常行为。 addFooterView()添加视图列表中,画面不是底部的结束。 (请参阅文档)。为了达到你希望看到什么,你需要把下面的 ListView的另一固定视图 - 例如,的LinearLayout 含在底部的的ListView 在顶部和另一个的LinearLayout

That's normal behavior for a ListView. addFooterView() adds the view to the end of the list, not the bottom of the screen. (See documentation). To achieve what you hope to see, you'll need to place another fixed View below the ListView -- for example, a LinearLayout containing the ListView at the top and another LinearLayout at the bottom.

这篇关于安卓:我如何得到一个ListView停止治疗页脚列表中的一个元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆