我想这样设计我的界面:
我尝试我的代码,显示界面如下所示:
我想做设计,顶部的任何按钮和按钮底部的列表视图,如何?与列表活动。
我有这样的文件 Datalist.java :
public class DataList extends ListActivity{
private ListView conListView;
private CursorAdapter conAdapter;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
conListView=getListView();
conListView.setOnItemClickListener(viewConListener);
// map each name to a TextView
String[] from = new String[] { "nama" };
int[] to = new int[] { R.id.dataTextView};
conAdapter = new SimpleCursorAdapter(DataList.this, R.layout.data_list, null, from, to);
setListAdapter(conAdapter); // set adapter
}
}
并有这样的 data_list.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="fill_parent"
android:orientation="vertical" >
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dataTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="8dp"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>
感谢提前。