Material theme elements missing when building Unity3d project

485 views Asked by At

I have a project that has a combination of native Android activities as well as a UnityPlayer.

The project is setup such that I can do my Android UI work in Android Studio, build the project as a library, and execute through Android studio via a special "bootstrap" project allowing me to deploy directly to my device via Android Studio (the Unity player does not function in this case).

If I want to run the Unity player, I export the library project as a .aar archive and place it in my Unity plugins folder. I then deploy to my device through Unity -> Build & Run.

The bootstrap project contains no classes or styles of its own, it is simply a wrapper to enable rapid deployment when working on Android-specific code.

For the most part, this works reasonably well. However, I'm noticing some visual differences between the bootstrap build and the Unity build. Specifically, the android:elevation tag does not function anywhere in the app. Also - my ripple drawable buttons animate within a small square area instead of the full circle that is visible in the bootstrap project. See screenshots below.

All of my activities inherit from AppCompatActivity, and I'm using a custom theme that inherits from Theme.AppCompat.Light.NoActionBar. I'm testing on both a Nexus 6 running 5.1.1 and a Nexus 9 running 5.0. My minimum SDK level is 15, target SDK is 22.

Other style elements work fine - the primary/primary dark/accent colours are fine. How can I make the Unity build appear the same as the native Android build?

Bootstrap build Screenshots

Full circle ripple

Elevation working

Unity build screenshots

Cropped ripple

No elevation

styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
</style>

Bootstrap manifest

<manifest package="<mypackage>.bootstrap"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    tools:replace="android:icon"/>

</manifest>

Library project manifest

<manifest
package="<mypackage>"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.INTERNET"/>

<uses-feature
    android:name="android.hardware.bluetooth_le"
    android:required="false"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <!-- Activities and services -->
</application>

</manifest>
0

There are 0 answers