Wie kann ich eine Chrome-ähnliche "Auto-Hide-Navigation" für meine Android-App implementieren?
In Chrome wird die Adressleiste ausgeblendet / angezeigt, wenn der Nutzer den Inhalt nach oben / unten streicht.
Kann ich die ähnliche Logik für meine App implementieren?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<WebView
android:id="@+id/my_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
Ich frage mich, ob ich mit dem folgenden Code etwas tun kann, damit die Aktionsleiste ausgeblendet / angezeigt wird, wenn der Benutzer mit dem Finger über die Webansicht fährt.
WebView webView = (WebView) findViewById(R.id.my_webview);
webView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch (View v, MotionEvent event) {
webView.onTouchEvent(event);
}
});