在Google Chrome和Play商店中.应用程序可以在滚动时隐藏操作栏,并允许用户方便地浏览.请帮我这样做.
我使用onTouchListener进行webview它不起作用.
mWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
getSupportActionBar().show();
break;
case MotionEvent.ACTION_UP:
getSupportActionBar().hide();
break;
default: break;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
提前致谢
如何像chrome浏览器一样拆分菜单,如图所示:
这是我的实际代码
<menu 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"
tools:context="materialtest.vivz.slidenerd.activities.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
Run Code Online (Sandbox Code Playgroud)