I want to hide top content of webpage in webview - java

I have webpage but I don't want navigation menu and search box. Can we float the webview container?
How to hide through android-webview?

mWebView.setVisibility(View.GONE); & mWebView.setVisibility(View.VISIBLE);
Do not use INVISIBLE setting.

Related

How to use one Webview for a bottomactuvity

I want to create an app like Ali express. An app for an online store. I am using the bottom navigation activity in android studio with Java language but I don't know how to use the webview so that if any of the bottom activity is clicked it would display a particular URL. For instance, the home, categories, cart.
Try this code :
In Xml add webview according to you for example like this:
<WebView
<!-- covers 368dp width as required. -->
android:layout_width="368dp"
<!-- unique ID of WebView -->
android:id="#+id/web"
<!-- covers 495dp height as required. -->
android:layout_height="495dp"/>
In Java add this :
WebView w = (WebView) findViewById(R.id.web);
// loading http://www.google.com url in the the WebView.
w.loadUrl("http://www.google.com");
// this will enable the javascipt.
w.getSettings().setJavaScriptEnabled(true);
// WebViewClient allows you to handle
// onPageFinished and override Url loading.
w.setWebViewClient(new WebViewClient());
for more information visit Web View Documention
OUTPUT :

How to create full screen MaterialAlertDialog

I am trying to show a full screen alert dialog like the one on the material design website: Full Screen Material Alert Dialog
I created a
new MaterialAlertDialogBuilder(this)
.setTitle("Title")
.setMessage("Message")
.setPositiveButton("Yes", null)
.show();
which works perfectly. However I want the dialog to appear as full screen with the toolbar and x button, so I can place EditTexts inside the dialog.
I tried using the other constructor MaterialAlertDialogBuilder(context, theme) but I cannot find a theme that will make the dialog appearance full screen. Is there a theme that makes the dialog full screen or do I have to do something else to make it full screen?
try this
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(this, android.R.style.Theme_DeviceDefault_NoActionBar_Fullscreen);

Handling pop-up in android app using Appium

i am using Appium(java) to test android app that contains pop-up window ,(pop-up appears after clicking a button..)
the popup compose from :
Framelayout with resource-id : android:id/content
LinearLayout with resource-id :android:id/parentPanel
LinearLayout (contain 2 buttons) with resource-id :android:id/buttonPanel
i want to press 1 of the buttons inside it ...
i tried verity of options that i found on the web , but nothing works
you can use self.driver.find_element_by_name("text to be clicked")

JavaFX How to get a children (WebView) from a Tab?

I have just started to do things with JavaFX and I'm trying to 'build' an browser. Right now I have a TabPane with two tabs. One tab has a WebView and the other tab is able to add new tabs. Over the TabPane is a Textfield. When I enter an internet adress I want to load a website in the selected Tab.
My Problem is, that I dont know how to get the Webview inside the selected Tab. I was able to get the selected Tab, but I have no Idea how to get the WebView inside it.
int index = TabPane.getSelectionModel().getSelectedIndex();
Tab selectedTab = TabPane.getTabs().get(index);
You could always call selectedTab.getContent(), and then navigate down through the scene graph hierarchy until you get to the right element. E.g. if your tab content is a BorderPane and the WebView is in the center you could do
BorderPane selectedBorderPane = (BorderPane) selectedTab.getContent();
WebView selectedWebView = (WebView) selectedBorderPane.getCenter();
This is pretty ugly code, though, and you'd have to rewrite it any time you changed the layout, which means your application becomes hard to maintain.
A (much) better way would be to create a variable at the appropriate scope (controller for the view that displays the tab pane, or the class that contains it if you're doing the layout in Java) for the current web view:
private WebView currentWebView ;
Then whenever you create a new tab containing a web view, add a listener to the tab's selectedProperty:
Tab tab = new Tab(...);
// ...
WebView webView = new WebView(...);
// ... layout, etc tab content, etc...
tab.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected) {
currentWebView = webView ;
}
});
Now currentWebView always references the currently displayed web view. (You will also need to initialize it to the first web view displayed at startup.)

JFace Action and ImageDescriptor - I wnt to show image and text

Action myAction= new Action("LABEL", ImageCache.getImageDescriptor("IMAGE"));
This code shows me a button without any text. Instead it only shows the image.
What should I do to display them both side by side?
I tried using setText() and setDescription() and setImageDescriptor() but none helped.
Text is not normally shown for an action in a ToolBar if there is also an image.
If you are adding the Action to the tool bar manager using an ActionContributionItem you can call ActionContributionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);

Categories