我想在我的GLSurfaceView上創建另一個視圖,我已經設法做到這一點,但由於某種原因,這一次沒有任何可見的。我做這一切的代碼,但下面是應該如何使用XML:爲什麼我的視圖不可見?
setContentView(R.layout.main);
adLinearLayout = (LinearLayout)findViewById(R.id.AdLinearLayout);
//If ad is found on server...Do this (view is passed into the method)
LayoutParams layout = new LayoutParams(adLinearLayout.getMeasuredWidth(), (adLinearLayout.getMeasuredWidth()*10)/64);
adView.setLayoutParams(layout);
adLinearLayout.removeAllViews();
adLinearLayout.addView(adView);
而且我的這種解釋是:
glView = new GLSurfaceView(this);
glView.setRenderer(this);
setContentView(glView);
adLinearLayout = new LinearLayout(this);
adLinearLayout.setGravity(Gravity.CENTER | Gravity.BOTTOM);
this.addContentView(adLinearLayout, new LayoutParams(480, 150));
//If ad is found on server...Do This (view is passed into the method)
LayoutParams layout = new LayoutParams(adLinearLayout.getMeasuredWidth(), (adLinearLayout.getMeasuredWidth()*10)/64);
view.setLayoutParams(layout);
adLinearLayout.removeAllViews();
adLinearLayout.addView(view, new LayoutParams(LayoutParams.WRAP_CONTENT ,LayoutParams.WRAP_CONTENT));
這絕不會顯示在屏幕上的視圖,雖然,有沒有有什麼缺失?
您是否得到了解決方案? – sahu