1#
安卓开发qq群273843464欢迎您的加入~~

思路就是实例化listview和linearLayout然后讲listView添加到linearLayout里面,最后记得将linearlayout用setContentView()方法刷新界面

m_ListView = new ListView(this);
        LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        m_ListView.setBackgroundColor(Color.BLACK);

                //在线性布局中添加listView
        m_LinearLayout.addView(m_ListView, param);