简体   繁体   English

一个LinearLayout和一个ListView在一个视图中?

[英]A LinearLayout and a ListView be in one view?

Example: 例:

Main LinearLayout 主要LinearLayout

|Sub LinearLayout|ListView | | Sub LinearLayout | ListView |

ListView has a set of names, which change the sub linear layout's content. ListView具有一组名称,这些名称更改子线性布局的内容。 Now I have the sub LL in my main LL. 现在,我的主LL中有子LL。 How do I add the ListView properly, using an 如何使用

arraylist<string> ar

But I don't know how to properly use the list adapter. 但是我不知道如何正确使用列表适配器。

One other question: can I update the listview contents with a thread every few seconds? 另一个问题:我可以每隔几秒钟用一个线程更新listview内容吗?

Try this one to update every few second. 尝试每隔几秒钟更新一次。

handler=new Handler();
            final Runnable r = new Runnable()
            {
                public void run() 
                {
                    //Write your code here

                    handler.postDelayed(this, 100);
                }
            };

            handler.postDelayed(r,100);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM