我已经使用 ListActivity 创建了列表视图,我想在该列表下方添加另一个视图。那么我该怎么做呢?这是我创建列表的 2 个文件 spacelist.xml 和 homescreen.java。
spacelist.xml-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:background="@drawable/background"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/ic_launcher" >
</ImageView>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@+id/label"
android:textSize="20dp" >
</TextView>
</LinearLayout>
homeScreen.java-
public class homeScreen extends ListActivity{
String list[]={"My Ideas","Space1","Space2","All Notes","Create New Space"};
ListView spaces;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//To display as a list
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.spacelist, R.id.label, list);
setListAdapter(adapter);
}
}
现在假设我想在列表下方添加另一个视图。我应该怎么做?