0
Ich habe so eine Oberflächenansicht erstellt.FullScreen für SurfaceView funktioniert nicht in Lollipop oder höher
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.networks.streaming.surfaceviewfullscreentest.MainActivity"
tools:showIn="@layout/activity_main">
<SurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/liveSurfaceView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:nestedScrollingEnabled="false"/>
</RelativeLayout>
MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
SurfaceView liveSurfaceView = (SurfaceView) findViewById(R.id.liveSurfaceView);
liveSurfaceView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE
);
getSupportActionBar().hide();
}
Dieser Code funktioniert in Android-Geräten mit Kitkat (API 19). Aber wenn ich denselben Code auf Geräten mit Lollipop oder höher ausführe, ist die resultierende Anzeige wie folgt.
die uper und unteren Grenzen sind sichtbar und Surfacevollbild nicht abdeckt. Wie kann ich das beheben? Danke
wie in Lollipop und höher auf Vollbild? Systemleiste und Navigationsleiste sind weiterhin sichtbar. –
Verwenden Sie Theme NoActiBar.FullScreen –
@android: Stil/Theme.NoTitleBar.Fullscreen –