2
我的應用程序隱藏/顯示視圖問題由屏幕的與佈置在2×2其中每個表4佈局圖,示出視頻與機器人
每個視圖包括播放控制。當我按下一個按鈕使全屏顯示時,應用程序顯示如下。 查看2重疊到全屏查看3。我想只能說明VIEW3爲全屏,並避免視圖2。
下面的代碼是用於隱藏/顯示視圖
@Override
public void toggleFullScreen()
{
mbFullscreen = !mbFullscreen;
mStrTmp = "";
Trace((ViewGroup)getRootView(), mbFullscreen);
mMessage.setText(mStrTmp);
}
private void Trace(ViewGroup layout, boolean bFullScreen) {
View FullScreenChild = null;
ViewGroup FullScreenLayout = null;
for(int i = 0; i < layout.getChildCount(); i++){
View child = layout.getChildAt(i);
if(child instanceof MtxVideoView){
if(child == this){
FullScreenChild = child;
FullScreenLayout = layout;
}
layout.setVisibility(bFullScreen?View.GONE:View.VISIBLE);
child.setVisibility(bFullScreen?View.GONE:View.VISIBLE);
}
else if (child instanceof ViewGroup) {
Trace((ViewGroup) child, bFullScreen);
}
}
if(bFullScreen){
if(FullScreenLayout != null)
FullScreenLayout.setVisibility(View.VISIBLE);
if(FullScreenChild != null){
FullScreenChild.setVisibility(View.VISIBLE);
mStrTmp = mStrTmp + "FullScreen";
}
}
}
下面
您的解決方案很好。謝謝 – Riskhan