他のウィジェットの中でも ListView を使用してアクティビティを実装しようとしています。したがって、正しく理解している場合は、ListActivity を使用できません (1 つの大きな ListView しか表示されないため)。
Java でこれを行うさまざまな例を、 SO のようなthis
または
this
またはgreat exampleから見つけました。
私は同じ方法でやろうとしましたが、正しく動作しません。この機能はモノアンドロイドにまったく存在するのですか?
これとこの例では、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;
}