我正在尝试为我正在开发的社交应用程序开发一个注册菜单。我希望注册菜单包含一个包含五个片段的 PageViewer。最后三个片段包含一个 ListView,用户可以在其中“检查”有关他们自己的信息。XML 在这里:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/layoutSignupLists">
<TextView
android:text="Add something here"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/signupListDescription" />
<ListView
android:id="@+id/interestListView"
android:layout_below="@id/signupListDescription"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
当最后三个片段创建正确显示时,此布局会膨胀。我已经订阅了 ListView 中 itemSelected 事件的委托,如下所示:
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
//Inflate view and find content
View view = inflater.Inflate(Resource.Layout.signupFragLayout4, container, false);
interestListView = view.FindViewById <ListView>(Resource.Id.interestListView);
var desc = view.FindViewById<TextView>(Resource.Id.signupListDescription);
//Adds the description
desc.Text = GetString(Resource.String.profile_menu_edit_interests);
//Populate ListView
interestListView.Adapter = new ArrayAdapter<string>(Activity,
Resource.Layout.CheckedListViewItem, MainActivity.InfoNames[(int)InfoType.Interest]); …Run Code Online (Sandbox Code Playgroud)