Button as spinner in android - button

I have two buttons YES and NO.
If user click on the yes Button the Dropdown menu like Spinner should appear
which contains other parameters related to Yes.
user will select one Parameter from that menu(dropdown menu)
I used this line for spinner button
android:background="#android:drawable/btn_dropdown"
OnClick method for Button:
ArrayList<String> spinnerArray = new ArrayList<String>();
spinnerArray.add("one");
spinnerArray.add("two");
spinnerArray.add("three");
spinnerArray.add("four");
spinnerArray.add("five");
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
spinner.setAdapter(spinnerArrayAdapter);
spinner.setOnItemSelectedListener(this);
with this code my button is look like spinner but on Click dropdown menu not appearing.
How to do this.?????

set your spinner launch mode to dialog android:spinnerMode=dialog this will display a dialog on click and let the user choose a option.

Related

Popup Hide Show

I want to create show and hide a alert bar using (alert) button click, If i click that alert button it needs to show what is that alert & again I click that button it needs to be (Hide) visibility gone...I want to switch that visibility thats all.
How to do this in android kotlin, I am new to this field, Plz help me..
This is my code
// for alert popup
binding.alertImage.setOnClickListener {
binding.alertImage.setVisibility(View.INVISIBLE);
binding.scrollText1.visibility = View.VISIBLE
}

I have a table with records. No matter which View button I click, the bottom record is displayed

I have a table with a list of records. Each record has a View button. But no matter which View button I click, the bottom record (Acme6) gets opened?
enter image description here
It looks like you are sharing datasource for your list and details pages. If my assumption is correct, then you need to modify your view button event handler as follow:
// onClick event handler for View button
var rowItem = widget.datasource.item;
var listDatasource = widget.parent.parent.datasource;
listDatasource.selectKey(rowItem._key);
app.showPage(app.pages.DetailsPage);

JavaFX Split Menu Button Arrow Trigger Event save clicked item in string

I have a SplitMenuButton, and I can't seem to find a way to trigger an event when the user clicks the arrow next to the button.
I would like to select item from dropdown(when mouse clicked on that item), display that in splitmenubutton and store value of that item in string to send to database.
I am not sure which event can do that, and I can not find any info on this either.
You can do something like.
for (final MenuItem item : smb.getItems()) {
item.setOnAction((event) -> {
System.out.println("Selected!");
});
}

always clicks first menu item after hover

I have a menu that is only visible after a mouse hover. The mouse hover works and the menu becomes visible for a moment. An attempted click action always clicks the first item in the menu. I want to command it to click any item in the list. I am currently using the id to find.
IWebElement settingsMenu = _driver.FindElement(By.Id("ctl00_ctl00_Main_Header_SettingsMenu"));
var actionbuilder = new Actions(_driver);
actionbuilder.MoveToElement(settingsMenu);
actionbuilder.Perform(); //perform menu hover, this always works
//menu items now visible
IWebElement ScheduleSettings = _driver.FindElement(By.Id("ctl00_ctl00_Main_Header_lnkSchedulingSettings"));
actionbuilder.MoveToElement(ScheduleSettings);
actionbuilder.Perform();
ScheduleSettings.Click();
The ScheduleSettings is the second item in the menu from top to bottom. The first item always gets clicked.
use this when you are building your driver
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("enablePersistentHover", false);
driver = new InternetExplorerDriver(capabilities);

Details View in Asp.net, Set it to NEW

I have a grid view on my page, and a hidden details view.
When the user wants to add a new entry, they will click a button, and the gridview will become hidden and the details view will become visible. The only problem is I want my details view to automatically be set empty in the NEW mode, without them having to click the new in the details view form.
In the RowCommand event of the gridview:
myDetailsView.Visible = true;
myDetailsView.CurrentMode = DetailsViewMode.Insert;
myGridView.Visible = false;
On button click change the mode like:
DetailsView1.ChangeMode(DetailsViewMode.Insert)

Resources