Log in or register to post comments

Creating Custom Layout in android studio imported Unity project

January 16, 2018 - 4:00am #1

I am working on an augment reality android app. I developed the app in unity using vuforia and then imported it in android studio as i wanted to design it in android studio. The activity name in generated project structure is UnityPlayerActivity which has no layout in the project. The activity is passed to UnityPlayer class and the layout is generated. This is some code of my UnityPlayerActivity activity.

 

protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

// Setup activity layout

@Override protected void onCreate(Bundle savedInstanceState)

{

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    super.onCreate(savedInstanceState);

    getWindow().setFormat(PixelFormat.RGBX_8888); // <--- This makes xperia play happy

    mUnityPlayer = new UnityPlayer(this);

    setContentView(mUnityPlayer);

    mUnityPlayer.requestFocus();

}

I want to customize the layout. I have tried the following links to solve the problem but they don't seem to work. Can somebody tell me how can i generate customized layout for this activity? App's current activity screenshot is attached.

http://www.41post.com/5292/programming/unity-and-android-create-an-unity-app-with-a-custom-layout

https://developer.vuforia.com/forum/unity-extension-technical-discussion/extending-unity-android-activity-android-studio

Activity Image

Log in or register to post comments