In my application i have to display a listview and below to that i have to display a textview.Is it possible to have listview and textview in the same layout? My code is as follows:
setContentView(R.layout.report);
ListView lv=(ListView)findViewById(R.id.listView1);
db.open();
Cursor c = db.getAllTitles();
startManagingCursor(c);
String[] from = new String[] { db.KEY_INCOME,db.KEY_DESC};
int[] to = new int[] { R.id.textView1 ,R.id.textView2};
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.report, c, from, to);
// System.out.println("notes="+notes.getCount());
lv.setAdapter(notes);
String total= db.add();
实际上,我正在显示两个文本视图以显示列表中的数据,最后我必须添加第三个文本视图以显示全线,如果我放相对版式的话,这个列表视图将适当地压倒另一个。 我的 Xml 文件如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</ListView>
谁来帮帮我,谢谢你们