Iam trying to add unityview as subview in android layout. I create relative layout in android xml file and added unityview to relativelayout. But the unityview is appearing as small image at left bottom of relative layout.
The black portion is my relativelayout but unity view not occupying enter relative layout.
The code is as follows:
public class MainActivity extends UnityPlayerActivity {
public static Context mContext;
private Handler handler=new Handler();
private UnityPlayer m_UnityPlayer;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
mContext = this;
m_UnityPlayer = new UnityPlayer(this);
int glesMode = m_UnityPlayer.getSettings().getInt("gles_mode", 1);
boolean trueColor8888 = false;
m_UnityPlayer.init(glesMode, trueColor8888);
setContentView(R.layout.activity_main);
//This is my relative layout
RelativeLayout layout = (RelativeLayout) findViewById(R.id.relativelayout2);
//Relativelayout width is 750dp and height is 640dp.
LayoutParams lp = new LayoutParams (750, 640);
//Iam adding unityview to layout here
layout.addView(m_UnityPlayer.getView(), 0, lp);
}
}