【发布时间】:2014-02-21 21:41:35
【问题描述】:
我正在做一个视频会议应用程序,其中我有一个框架布局,它将具有用于呈现视频的表面视图和用于结束该参与者呼叫的按钮。
由于可以动态添加参与者,因此当请求创建新用户时,我必须扩展此布局。
这个膨胀的布局将被添加到 tablelayout 中,这样我就可以容纳许多我想要的布局/用户。
我正在像这样膨胀 FrameLayout:
participantHolder.mParticipantFrameLayout = (FrameLayout)mInflater.inflate(R.layout.generic_paritcipant_layout, null);
我正在使用此布局中获取表面视图按钮:
//get the Dropuser button
participantHolder.mParticipantDropButton = (ImageButton)mFrameLayt.findViewById(R.id.ParticipantDropButton);
//get the surfaceview
participantHolder.mParticipantSurfaceView = (SurfaceView)mFrameLayt.findViewById(R.id.ParticipantSurfaceView);
并通过设置布局参数将布局添加到表格行中。
TableRow.LayoutParams PreviewLayoutParams = new TableRow.LayoutParams(0, TableRow.LayoutParams.MATCH_PARENT);
PreviewLayoutParams.weight = 1;
CurrentParticpant.mParticipantUIHolder.mParticipantFrameLayout.setLayoutParams(PreviewLayoutParams);
CurrentParticpant.mParticipantUIHolder.mParticipantFrameLayout.invalidate();
mTableRowOne.addView(CurrentParticpant.mParticipantUIHolder.mParticipantFrameLayout);
mTableRowOne.invalidate();
mTableLayoutReference.invalidate();
但我根本看不到视图/布局,如果我做错了什么请告诉我
【问题讨论】:
-
你的
mParticipantDropButton和mParticipantSurfaceView不应该在mParticipantFrameLayout里面吗? -
mFrameLayt 这里什么都不是,但我将它称为 mFrameLayt =参与者Holder.mParticipantFrameLayout;两者都一样