Hello,

I'm trying to develop a simple application (game) for Android using 
SurfaceView and I did it, but on few phones there is a problem and I don't 
know what to do to fix it.
The problem is that on few phones there are horioznal bars:

<https://lh3.googleusercontent.com/-UVnbRhwORwU/WuApo9k954I/AAAAAAAAA_U/2Fb0LXTGxWkCDQuXHzxWSQnM7hg3lr3hwCLcBGAs/s1600/MI%2B5%2B-%2BAndroid7.0.png>
*(Screen from MI 5 - Android 7.0.NRD90M)*

To display graphics I'm using SurfaceView on a Activity (nothing else). 
Drawing operations are really simple:
- Canvas.drawColor - to clear surface
- Canvas.drawText - to draw FPS, Points etc,
- Canvas.drawRect - to draw level outline (black color),
- Canvas.drawBitmap - to draw level (grid) and blocks,
- Canvas.drawLine - to draw block outline.

I have checked my code. There is no drawRect operation with given height 
and color.
There is only one drawRect and is with black color to draw level outline.

I have checked this screen and the horizontal bars are the same color and 
height that the Android status bar.
The amount of bars is diffrent on other test phone:

<https://lh3.googleusercontent.com/-HZUBOmPrWMo/WuAq6pyCKrI/AAAAAAAAA_g/NhEGzd6kXmwJQt_nicNBg9_9fsL0AVMXwCLcBGAs/s1600/SonyMobile%2B-%2BAndroid7.1.1.jpg>

*(Screen from Sony Mobile - E6653, Android 7.1.1)*


To be sure, I have changed colors of status bar, to colors not used in my 
application:

<resources>
<!--    <color name="colorPrimary">#22AAA8</color>
    <color name="colorPrimaryDark">#22AAA8</color>
    <color name="colorAccent">#FF4081</color>-->

    <color name="colorPrimary">#ffAAA8</color>
    <color name="colorPrimaryDark">#ffAAA8</color>
    <color name="colorAccent">#FA4081</color>

...

</resources>


And the color of this bar has changed to that color (colorPrimary or 
colorPrimaryDark):

<https://lh3.googleusercontent.com/-qr84srxNnBg/WuArkSzAq4I/AAAAAAAAA_o/tWuFHNYyX5cSdQOgMvH5gt4xPGyaeU2xACLcBGAs/s1600/MI.jpeg>

*(Photo of MI phone)*


All drawing on SurfaceView is done from one thread:

public abstract class DrawThread extends Thread {

...

    @Override
    public void run() {

        ...

        Canvas c=holder.lockCanvas();

        if(c!=null) {

            try {

                draw(c, elapsed);

            } finally {

                holder.unlockCanvasAndPost(c);

            }

        }

    }

...

}


Any help would be appreciated.

-- 

Greetings,

Ryszard Trojnacki


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/d83acb5a-88da-49d1-9d9f-a3b5425fa835%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to