How to specify which layout to use for Android Wearable?

I have a custom view with the onTouch method, which triggers another action with its own XML layout. If I run the program on an emulator that was scaled to view the size (yes, only the scaled, normal emulator is fine), it creates an instance of the new action with both round and direct layout files. In addition, logcat says eglSurfaceAttrib is not implemented.

Because this only happens on a scaled emulator, is this just a bug with the emulator? I don’t have a real watch for Android yet. Or is there a way to pack some attribute with an intention that starts activity in order to tell him that I want one of the layouts?

Edit: problem with emulator regardless of size and shape

+4
source share
1 answer

The best way to customize your screen size or aspect ratio is with the help of qualifiers for alternative resources .

Based on developer documentation, using a qualifier watchfor your resource is likely to do the trick. Your directory hierarchy will look something like this:

src/
res/
    layout/
        (all of your regular layouts)
    layout-watch/
        (all of your Android Wearable layouts)
+3
source

Source: https://habr.com/ru/post/1546582/


All Articles