Material theme elements missing when creating a Unity3d project
I have a project that has a combination of native Android actions as well as UnityPlayer.
The project is set up in such a way that I can do my Android UI work in Android Studio, build the project as a library, and execute through android studio through a special "bootstrap" project that allows me to directly connect to my device through Android Studio (in this case, the Unity player does not work).
If I want to launch the Unity player, I export the library project as an .aar archive and put it in my Unity plugins folder. Then I deploy my device via Unity -> Build and Run.
There are no classes or styles in the bootstrap project, it is just a wrapper for quick deployment when working with Android specific code.
For the most part, this works well enough. However, I do notice some visual differences between the bootstrap build and the Unity build. In particular, the tag android:elevation
doesn't work anywhere in the app. Also, my rippled buttons can be animated within a small square area instead of the full circle that appears in the boot project. See screenshots below.
All my actions inherit from AppCompatActivity
, and I am using a custom theme that inherits from Theme.AppCompat.Light.NoActionBar
. I am testing both Nexus 6 with 5.1.1 and Nexus 9 with 5.0. My minimum SDK level is 15, target SDK is 22.
Other stylish elements work great - primary / primary dark / accent colors are great. How can I make Unity's build look like Android's native build?
Bootstrap Build Screenshots
Unity build screenshots
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 Manifesto
<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>
source to share
No one has answered this question yet
Check out similar questions: