1

我试图在 LinearLayout 中插入 2(userListGroup.size()=2) 视图的列表,但由于某种原因,每次只有 1 个视图出现在应用程序中。
我有一个这样的 LinearLayout 代码

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>
4

0 回答 0