0
我通过扩展ListActivity来填充列表。我已将列表添加到列表中以显示列表中项目的总数。在ListActivity中为TextView设置文本
我在一个单独的布局文件header.xml中维护了标题视图,如下所示。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/headerTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Total number of devices :"
android:textSize="15dip"
android:layout_weight="1" />
</LinearLayout>
这是怎么了增加头部在ListViewActivity类名单,
ListView lv = getListView();
LayoutInflater inflater = getLayoutInflater();
ViewGroup header = (ViewGroup)inflater.inflate(R.layout.header, lv, false);
lv.addHeaderView(header, null, false);
如何设置页眉的TextView的文本?我尝试了以下,并为TextView返回null。
TextView textBox = (TextView)findViewById(R.id.);
textBox.setText("Count");