How to change the button with a spinner in actionbar to loading? - java

I have a webview and want to listen its loading event and I have a refresh button on my actionbar.
How to change the button to a spinner programmatically?

You can't magically change a button into a spinner. What you can do is disable the button and enable the spinner.
myButton.setEnabled(false);
mySpinner.setEnabled(true);
If you want to make the spinner take the place of the button, then you're going to have to put all of your layout drawing routine into a buildLayout() (or whatever you want to call it) and redraw the entire layout with a button or with a spinner, depending on the state of your application.

Related

Clear focus of BottomSheetDialog

I have a ListView in my layout. I have attached onItemClickListener for ListView to listen for item clicks. Whenever I will click on the item of it, a BottomSheetDialog will inflate. The problem is, that I want the content outside bottomsheetdialog to be clickable and scrollable. Whenever I inflate BottomSheetDialog, the content outside it becomes unresponsive. It doesn't respond to clicks, scroll etc. How can I make the content outside it to still be clickable and scrollable?

How to display pop up menu for Dynamically created Imageviews

I am Creating a ImageViews dynamically now i need to display pop up menu if click the ImageView.
ex: In that pop up i will add download. If i click that download button respective Image should download.
I'm not very sure about putting a button on an imageview...take a look at this answer:
Put a button over an ImageView
As for making a popup appear on button click, use dialogfragments.

How to add toggle, switch button in WIDGET

I want to add toggle button and switch in app widget. How can I add them? I do not understand how to assign button id. Normaly we use FindViewById but what should I use in a widget?
Togglebutton a = (TB) FindViewById(R.ID.xyz)
I also added one text view widget and now I want when I click on it to update that TextView.
ToggleButton is not supported on widgets, use instead an ImageView (change image source dynamically).

Changing a Toggle buttons Background

I want to change the toggle button background to an image where I click and it gets darker and then once I release it reverts back to the same image. I've managed to successfully do this with a button but I require a toggle button for my app. I tried this with the toggle button and only managed to change the background image of the toggle button. however, the little green check box thing was still there.
I think using the xml drawable for the toggle button is better for your requirement . click here for styling your toggle buttons

Android popupwindow outsidetouchable and ontouch listener

Hi I have a popupwindow on my project.
I want these;
The outside of popupwindow will be touchable and
The popupwindow will be dissmiss when clik on popupwindow.
Actualy I want to use this like
Full screen back button.
I have a full screen button. it makes some components to full screen.
I want to put a popup button full go back from fullscreen view.
How can I do this ?
Sorry for bad english.
Thanks...

Categories