我试图在LinearLayout中插入2(userListGroup.size()= 2)视图的列表但由于某种原因,每次只有1个视图在应用程序中出现。
我有一个类似于
for (AssignmentUser assignuser : userListGroup) {
User user = assignuser.getUser();
LayoutInflater inflater = LCloudAssignmentDetailActivity.this.getLayoutInflater();
View rowView = inflater.inflate(R.layout.assignment_group_inner_attempt_row, null);
ViewHolderGroupSubmission mHolder = new ViewHolderGroupSubmission();
mHolder.profilePicture = (ImageView) rowView.findViewById(R.id.profole_pic);
mHolder.submittersUserName = (TextView) rowView.findViewById(R.id.assignment_submission_author);
mHolder.submissionListHolder = (LinearLayout) rowView.findViewById(R.id.user_submission_list);
mHolder.submittersUserName.setText(user.getFirstName() + " " + user.getLastName());
imageLoader = new ImageLoader(LCloudAssignmentDetailActivity.this);
imageLoader.getLazyLoadingImage(Constants.PHOTO_BASE_URL + user.getPhotoImageUrl(), mHolder.profilePicture);
buildIndividualSubmissionListAdapter(mHolder.submissionListHolder, assignuser.getAssignmentSubmissionList(), assignuser.getUser().getUserId());
linearLayout.addView(rowView);
}
并且layout.xml代码是
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/base_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:stretchColumns="1" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<ImageView
android:id="@+id/profole_pic"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginRight="10dp"
android:layout_marginTop="19dp"
android:src="@drawable/app_icon" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/linearLayout1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="4dp"
android:paddingTop="10dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/assignment_submission_author"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="James Smith"
android:textColor="@color/forums_primary_txt_color" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginBottom="2dp"
android:layout_marginRight="@dimen/dimen_dboard_component_top_marg_15"
android:layout_marginTop="3dp"
android:background="@drawable/horz_devider" />
<LinearLayout
android:id="@+id/user_submission_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="18dp"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>