问题描述
在片段之一的WebView中键入键盘时,如何隐藏底部导航栏?
这是我的片段:
public class chatFragment extends Fragment {
LinearLayout eLinearLayout_chat;
WebView webView_chat;
ProgressBar mProgressBar_chat;
BottomNavigationView nav;
//SwipeRefreshLayout swipeRefreshLayout_chat;
// Firebase instance variables
//private FirebaseAuth mFirebaseAuth;
//private FirebaseUser mFirebaseUser;
//private String mUsername;
//private String mPhotoUrl;
public chatFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_chat,container,false);
webView_chat = (WebView) v.findViewById(R.id.webview_chat);
eLinearLayout_chat = (LinearLayout) v.findViewById(R.id.LinearWebView_chat);
mProgressBar_chat = (ProgressBar) v.findViewById(R.id.progressBar_chat);
nav = (BottomNavigationView) v.getRootView().findViewById(R.id.bottom_navigation);
//swipeRefreshLayout_chat = (SwipeRefreshLayout) v.findViewById(R.id.swipeweb_chat);
webView_chat.loadUrl("https://drriyadh-lab.xyz/track/");
webView_chat.getSettings().setJavaScriptEnabled(true);
webView_chat.getSettings().setUseWideViewPort(true);
webView_chat.getSettings().setDomStorageEnabled(true);
webView_chat.getSettings().setSupportZoom(false);
webView_chat.getSettings().setAppCacheEnabled(true);
webView_chat.getSettings().setDatabaseEnabled(true);
webView_chat.getSettings().setAllowFileAccess(true);
webView_chat.getSettings().setAllowContentAccess(true);
webView_chat.getSettings().setSupportMultipleWindows(true);
webView_chat.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView_chat.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webView_chat.getSettings().setLoadWithOverviewMode(true);
webView_chat.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view,String url,Bitmap favicon) {
super.onPageStarted(view,url,favicon);
//mProgressBar_chat.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view,String url) {
super.onPageFinished(view,url);
mProgressBar_chat.setVisibility(View.GONE);
}
@Override
public void onReceivedError(WebView view,WebResourceRequest request,WebResourceError error) {
super.onReceivedError(view,request,error);
eLinearLayout_chat.setVisibility(View.VISIBLE);
view.setVisibility(View.GONE);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view,String url) {
if (url.contains("https://www.tidio.com/powered-by-tidio/live-chat/?platform=others&project=dc71bf5k0ncictpdhdyhujy2hzf9zn7x&device=mobile&utm_source=plugin_ref&utm_medium=widget_v4&utm_campaign=plugin_ref&utm_referrer=drriyadh-lab.xyz")) {
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
startActivity(intent);
return true;
}
if (url.startsWith("tel:") || url.startsWith("whatsapp:")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
}
// all the rest open in Webview // make it false to fisable button of powered by tidio (still but not work in webview) make it to false to make whatsapp link opened,make it true to disbale whatsapp link and enable powered by tidio link work but in external browser
return false;
}
});
return v;
}
}
我尝试了很多想法,但是没有找到任何解决方案,并且底部导航位于MainActivity中,底部导航栏中有3个片段。片段之一是WebView(如上所示)。当我输入键盘时,底部的导航键会向上移动键盘。我想在输入键盘时将其隐藏。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)