我正在尝试在其他小部件中实现带有ListView的活动。因此,如果我理解正确,我不能使用ListActivity(因为它仅显示一个大的ListView,这对我来说是可以的)。
我在SO上找到了很多不同的Java示例,比如这个,或者这个,或者这个很好的例子。
我尝试以同样的方式进行,但它不能正常工作。我很好奇这个功能在mono android中是否存在?
我只找到了一个在mono android中使用ListView的示例,即这个,而这个示例仅描述了使用ListActivity。
因此,我的布局:
我在SO上找到了很多不同的Java示例,比如这个,或者这个,或者这个很好的例子。
我尝试以同样的方式进行,但它不能正常工作。我很好奇这个功能在mono android中是否存在?
我只找到了一个在mono android中使用ListView的示例,即这个,而这个示例仅描述了使用ListActivity。
因此,我的布局:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:id="@+id/widget36"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</TableLayout>
我的OnCreate:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.CreateUser);
JavaList<string> somadata = new JavaList<string> { "111", "222", "333" };
ListView view = FindViewById<ListView>(Resource.Id.list);
view.Adapter = new ArrayAdapter<string>(this, Resource.Layout.CreateUser, somadata);
view.TextFilterEnabled = true;
}