我需要在android里給 mUnityPlayer 添加一個android的Layout,代碼大概如下,現在的問題如下
用unity4.7添加后圖片正常顯示,圖片背景的FrameLayout背景是透明的
但是我用unity5.5的話,addView后圖片背景始終是白色的,無法修改
我現在需要用在到處android的mUnityPlayer動態添加一個andor創建的view,需要view背景透明,可以看到背后的mUnityPlayer的其他內容,請問如何實作,因為android兼容性問題,需要unity5.5實作
mUnityPlayer = new UnityPlayer(this);
setContentView(mUnityPlayer);
mUnityPlayer.requestFocus();
final ImageView imageView = new ImageView(getBaseContext());
final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT);
params.topMargin = 0;
params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
imageView.setImageResource(R.drawable.app_icon);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setBackgroundColor(Color.TRANSPARENT);
//mUnityPlayer.addViewToPlayer(imageView, true);
mUnityPlayer.addView(imageView);
button.setBackgroundResource(R.drawable.app_icon);
uj5u.com熱心網友回復:
樓主解決了嗎?我遇到一個類似的問題uj5u.com熱心網友回復:
解決了嗎?樓主uj5u.com熱心網友回復:
解決了沒?我也遇到同樣的問題,讓人很難受啊。轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/50517.html
標籤:Unity3D
上一篇:初學者教程:KNN分類器
下一篇:Unity專案匯入Eclipse中提示your hardware does not support this application,這個該怎么辦,請大神指教
