Nick Jian
Nick Jian

Reputation: 455

Moto360 addview with black bar on bottom

everyone. I try to attach full screen view to moto360. However, when it works on LG/samsung square devices. It left a black out bar on bottom, which is about same size of original black bar on bottom. Is this a bug or what? anyone ever found this happened?

Here's my code:

    DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
    float width = metrics.widthPixels;
    float height = metrics.heightPixels;

    Log.d(TAG, "width: " + width + "   height:" + height);

    // attatch view to windows
    WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
    wmParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
    wmParams.format = PixelFormat.RGBA_8888;
    wmParams.flags = LayoutParams.FLAG_NOT_TOUCHABLE
            | LayoutParams.FLAG_NOT_FOCUSABLE
            | LayoutParams.TYPE_SYSTEM_OVERLAY;

    wmParams.gravity = Gravity.TOP | Gravity.TOP;
    wmParams.x = 0;
    wmParams.y = 0;
    wmParams.width = metrics.widthPixels;
    wmParams.height = metrics.heightPixels;

    wManager.addView(view, wmParams);

by the way, change metrics.widthPixels to Match_Parent is not working.

Any clue is appreciated. For now I suspect it is a bug on moto360 rom which consider the screen size as (real space - bottom bar size). So, when the view is attached, is return some black space on bottom.

example

Upvotes: 2

Views: 185

Answers (0)

Related Questions