0
id가 'toolbar_footer'인 툴바가 있습니다. 예 : 'index.php'에 대한 특정 URL에 대해이 툴바를 숨기는 방법 : 내 프로젝트의 mainactivity .Part가 아래에 나와 있습니다. 여러 번 시도해 보았지만 주어진 답변으로 제대로 작동하지 않아 XML 레이아웃 코드로 코드를 업데이트합니다.특정 webview URL에서 툴바 숨기기가 작동하지 않습니다.
도움을주세요 .. 내가 개월
이 problemm 오전private class UriWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String host = Uri.parse(url).getHost();
urlData = url;
if (target_url_prefix.equals(host)) {
if(url.contains("index.php") || url.contains("login.php") || url.contains("register.php")) {
System.out.println("This is my target url 2");
System.out.println(url);
//showToolBar = false;
findViewById(R.id.toolbar_footer).setVisibility(View.GONE);
}
else
{
findViewById(R.id.toolbar_footer).setVisibility(View.VISIBLE);
}
if (mWebviewPop != null) {
mWebviewPop.setVisibility(View.GONE);
mContainer.removeView(mWebviewPop);
mWebviewPop = null;
}
return false;
}
boolean result = UrlHander.checkUrl(MainActivity.this, url);
if (result) {
ProgressDialogHelper.dismissProgress();
} else {
currentUrl = url;
if (!show_content) {
if(url.contains("index.php") || url.contains("login.php") || url.contains("register.php")) {
System.out.println("This is my target url 2");
System.out.println(url);
//showToolBar = false;
findViewById(R.id.toolbar_footer).setVisibility(View.GONE);
findViewById(R.id.fab).setVisibility(View.GONE);
}
else
{
findViewById(R.id.toolbar_footer).setVisibility(View.VISIBLE);
findViewById(R.id.fab).setVisibility(View.VISIBLE);
}
ProgressDialogHelper.showProgress(MainActivity.this);
}
}
return result;
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
if (!NetworkHandler.isNetworkAvailable(view.getContext())) {
view.loadUrl("file:///android_asset/NoInternet.html");
}
hideStatusBar();
ProgressDialogHelper.dismissProgress();
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
if (!NetworkHandler.isNetworkAvailable(view.getContext())) {
view.loadUrl("file:///android_asset/NoInternet.html");
}
hideStatusBar();
ProgressDialogHelper.dismissProgress();
}
@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
super.onReceivedHttpError(view, request, errorResponse);
if (!NetworkHandler.isNetworkAvailable(view.getContext())) {
view.loadUrl("file:///android_asset/NoInternet.html");
}
hideStatusBar();
ProgressDialogHelper.dismissProgress();
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if(url.contains("index.php") || url.contains("login.php") || url.contains("register.php")) {
System.out.println("This is my target url 2");
System.out.println(url);
//showToolBar = false;
findViewById(R.id.toolbar_footer).setVisibility(View.GONE);
findViewById(R.id.fab).setVisibility(View.GONE);
}
else
{
findViewById(R.id.toolbar_footer).setVisibility(View.VISIBLE);
findViewById(R.id.fab).setVisibility(View.VISIBLE);
}
}
내 레이아웃 파일이 줄을 추가 돼 도구 모음을 숨기는
<?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"
xmlns:fab="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/webview_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
tools:context=".universalwebview.MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none" />
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="right|bottom"
android:layout_marginBottom="70dp"
android:layout_marginRight="10dp"
android:clickable="true"
android:src="@drawable/ic_action_share"
app:backgroundTint="#00a478"
app:borderWidth="0dp"
app:elevation="6dp"
app:fabSize="normal"
app:pressedTranslationZ="12dp"
app:rippleColor="#00a470" />
<LinearLayout
android:id="@+id/toolbar_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#333"
android:orientation="horizontal">
<ImageView
android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="10dp"
android:src="@drawable/ic_action_home"
android:tint="@color/tintcolor" />
<ImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="10dp"
android:src="@drawable/ic_action_search"
android:tint="@color/tintcolor" />
<ImageView
android:id="@+id/uploadvideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="10dp"
android:src="@drawable/ic_action_add"
android:tint="#00a478" />
<ImageView
android:id="@+id/profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="10dp"
android:src="@drawable/ic_action_profile"
android:tint="@color/tintcolor" />
<ImageView
android:id="@+id/settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="10dp"
android:src="@drawable/ic_action_settings"
android:tint="@color/tintcolor" />
</LinearLayout>
<ImageView
android:id="@+id/image_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:visibility="visible"
android:src="@drawable/splash" />
</RelativeLayout>