[Android Wear] BoxInsetLayout, explained.

As it can be read in the official doc, a BoxInsetLayout is a FrameLayout with additional features for displaying correctly on Wearable devices.

Using the layout_box attribute when placing Views inside our BoxInsetLayout, we can specify how these views will be positioned in round screens.

If the screen shape is square, the layout_box attribute will be ignored, and views will be positioned as they would in a regular FrameLayout.


<?xml version="1.0" encoding="utf-8"?>

    android:text="Top-Left boxed"/>
    android:text="Bottom-Right boxed"/>

In this code we are placing two TextViews inside our BoxInsetLayout. One will be placed on the bottom right corner, and the other will be placed on the upper left corner. With the layout_box attribute, we are also specifying that we want them to adapt their position on round screens, so the first one will be boxed on the upper left corner, and the second one will be boxed on the bottom right.

If we display this layout in a square Android Wear device, we’ll see no difference between the BoxInsetLayout and a normal FrameLayout.


But when testing our layout on a round screen, we will see that the layout_box rules we added are affecting to the TextView’s position.

Captura de pantalla 2015-02-22 a la(s) 18.49.24

As we can see, the TextViews are in the corners of the round screen. If no layout_box attribute is specified, we would have this:

Captura de pantalla 2015-02-22 a la(s) 18.51.06That’s the BoxInsetLayout’s essentials.

Have a nice coding!

[Windows 8.1] Black screen with cursor/pointer after login

Well, I wasn’t sure about if this post was appropiate for this blog or not. A 10-inch tablet running Windows 8.1 is actually a mobile device, plus this info may be helpful, so I decided to include it ;-).

If you find this error, that is becoming very usual as you may notice in forums, check if you are infected by the Binkiland virus.

When on the black screen, Hit Ctrl+Alt+Del.

Go to Task Manager, then Apps or Applications.

Right-click one of them, and select “Find on explorer”. You will have an access to a window running the Explorer.

Inside it, click on Control Panel, and then Uninstall an Application.

Select all applications related to “Binkiland” (there will be more than one), and delete them.

Windows will go back to its normal state, or at least it did in my tablet.

I strongly recommend to factory reset your device after this.

Hope it helps! Made me waste an hour to find this solution 😦

[Android SDK] Important note when creating SearchViews with Android Studio

One of the steps you have to follow when creating a Search interface is this one:

<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_search"
          android:actionViewClass="android.widget.SearchView" />

Note that Android Studio will suggest you to use yourapp:showAsAction instead of android:showAsAction, adding a new xml namespace (xmlns:android=”…” on the root element). DON’T DO THAT if you are not using the android-support-v7-appcompat library! Search view will never be displayed.

Captura de pantalla 2015-02-05 a la(s) 11.30.21

Don’t fix this issue if you are not using android-support-v7-appcompat. Leave the warning unmodified. Hope this saves you all the time i wasted discovering it 😛

[Android SDK] Android Clean Start: Another way of creating an Android Project

The cleanest way to create an Android project, without support library or any dependencies that we may not need. You need to add everything manually, but it gives you full control of your code.



/home/olmo/android-sdk-linux/tools/android list targets

Output looks like that:

 id: 2 or "android-23"
 Name: Android 6.0
 Type: Platform
 API level: 23
 Revision: 2
 Skins: HVGA, QVGA, ...
 Tag/ABIs : android-wear/x86, default/x86, default/x86_64

The id I want is 2, used for the –target option.

final project creation line is:

/home/olmo/android-sdk-linux/tools/android create project --package es.voghdev.hellofirebase --path . --target 2 --activity MainActivity

Then my empty Android application is created. Hope you like this method!