I had locked my app to portrait only mode and I handled orientation changes myself, but I realized that in landscape mode the status bar stays the same, and the UI experience would be bad.
Now, that I have developed everything accordingly, the only workaround seems to be for me is to change the status bar position programmatically, since I don't(or actually can't at this point) respect system orientation changes.
Is this possible? To change the status bar position programmatically? Only inside my app and restore once I exit?
Below I have illustrated the desired effect:
first, the app is locked to portrait mode and when I rotate the device the app's views rotate since I parse the raw sensor data and apply the rotation, but in this case the status bar doesn't rotate(since the app is locked to portrait mode, and I only have access to app's views for rotation):
A pseudocode of how I've done the above is:
View views[] = new View[]{view1, view2, view3, view4 ....};
float rotationAngle = parseRawSensorData();//typically accelerometer input
for(View view: views){
rotateWithAngle(rotationAngle);
}
Therefore the views rotate but the status bar is affixed.
what I'd like to do is to be able to rotate the status bar using some code like this:
i.e. rotate the statusbar according to the sensordata I fetch.
from can we change status bar or notification bar position programmatically
No comments:
Post a Comment