0
我有一个小问题。在我的表格行中,我想添加一个FacebookProfilePictureView,除了添加一个简单的ImageView外,这会导致一些错误。我附上了一张显示我收到的输出的图片。动态添加facebook个人资料图片在表格行中查看android
白框的序列号的右边是profilepicview设置,所有的时间。另外,在xml中,我将大小设置为50,50(宽度,高度),但在java中它变得杂乱。我的代码如下。
XML代码:
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/view_below_linear_layout_three_team_spuck"
android:id="@+id/the_maintable_team_spuck"
>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/the_maintable_row_team_spuck">
<com.facebook.login.widget.ProfilePictureView
android:id="@+id/profile_pic_view_team_spuck"
android:layout_width="50dp"
android:layout_height="50dp"
android:visibility="gone"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</TableRow>
</TableLayout>
Java代码:
the_normal_image_view = new ImageView(view.getContext()); // this is the normal image view, no issues when adding this in table
profilePictureView = new ProfilePictureView(view.getContext()); // this is the profile pic view
the_maintable_row_team_spuck.removeAllViews();
the_maintable_row_team_spuck.setLayoutParams(new TableRow.LayoutParams
(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
the_maintable_row.setBackgroundResource(R.drawable.cell_shape);
/*the_smallperson_team_spuck.setImageResource(R.drawable.the_smallperson);
the_smallperson_team_spuck.setPadding(7, 7, 15, 0);*/
profilePictureView.setPadding(7, 7, 15, 0);
//the_maintable_row.addView(the_normal_image_view); // adding normal image view into row
the_maintable_row.addView(profilePictureView); // adding fb profile pic view in to row
the_maintable.addView(the_maintable_row_team_spuck, new TableRow.LayoutParams
(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
任何帮助,将不胜感激,谢谢:)
如果我有朋友的ID,那么该怎么办? –
但你在哪里使用朋友的ID? 我想你只想显示个人资料照片仪式? –
我们可以使用朋友IDS来获取图片我认为... –