spinner

Async pipe to unsubscribe from ReplaySubject

纵饮孤独 提交于 2019-12-11 08:37:04
问题 I have the following service to accommodate for a global spinner in my app: import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { ReplaySubject } from 'rxjs/ReplaySubject'; @Injectable() export class SpinnerService { private visible = new ReplaySubject < boolean > (); showSpinner() { this.visible.next(true); } hideSpinner() { this.visible.next(false); } getSpinnerVisibility(): Observable < boolean > { return this.visible.asObservable(); } } Then

Android spinner prompt not working [duplicate]

╄→гoц情女王★ 提交于 2019-12-11 08:05:16
问题 This question already has answers here : How to make an Android Spinner with initial text “Select One”? (37 answers) Closed 6 years ago . I have Spinners that I am using in my application. They are working fine with one exception. I have set prompts for each one, but they are not showing. I am setting ArrayAdapters to the Spinners during onCreate , and my guess is that the setAdapter method is automatically setting the selection to position 0. Is there a way to set the prompt and have it work

How do I dynamically update a spinner using ArrayList?

走远了吗. 提交于 2019-12-11 07:36:14
问题 I have created a Spinner that is populated with an ArrayList . I want to dynamically add values to the ArrayList , so the the Spinner populates dynamically. However, when I try to add values to my ArrayList , I get a NullPointerException . What am I missing? Do I have to reset the adapter before amending the ArrayList ? Here is my code: My spinner, arraylist, and adapter: deleteselection = (Spinner)view.findViewById(R.id.deletespinner); portfoliosdelete = new ArrayList<String>();

How to grey out spinner in Android?

放肆的年华 提交于 2019-12-11 07:30:11
问题 I use two Spinner in my App. One of them is initially disabled because I need the user to select something in the first spinner to load the content of the second one. I would like to change the design of the second spinner to show the user that the spinner is not active, eg. grey the spinner out. How can I achieve this? If this is not possible how would you change this dialog to make it clear to the user that she has to select something in the first spinner? 回答1: Further to setting as

Android Spinner: Custom Adapter Display

柔情痞子 提交于 2019-12-11 07:17:30
问题 I am using a SimpleCursorAdapter on my spinner because I want to create a custom dropDownList that contains multiple rows and populate it from my database. I have accomplished this task quite nicely, but on my layout activity, the spinner shows the selected rows and I would like it to have a separate layout so it shows only the first line of the selected row. How can I accomplish this? String fields[] = {"name", "lovibond", "gravity"}; nameAdapter = new GrainSpinnerAdapter(this, R.layout

How to style spinner prompt?

痴心易碎 提交于 2019-12-11 07:02:46
问题 I have successfully styled spinner background like here: How to set font custom font to Spinner text programmatically? My opened spinner looks like this: Only thing that is left to style is spinner prompt box (and text inside). How can i change background color and font of spinner prompt? EDIT:Based on 2red13 advice i created style: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="spinner_style"> <item name="android:layout_width">fill_parent</item> <item name="android:layout

Populating Spinner using string values returned by SOAP web service

荒凉一梦 提交于 2019-12-11 06:59:20
问题 I am working on a Android code that returns me String values that I store in a String array.I want to use this String array to populate one of my Spinners. My main intention is that depending on what the user selects in 1st spinner , I want to populate my 2nd spinner using my String array. However, when I try I am getting a NullPointerException even when I am populating the adapter My Android code: public class Mark2 extends Activity { private static final String SOAP_ACTION = "http://tempuri

OnItemSelectedListener called on screen rotation

拟墨画扇 提交于 2019-12-11 06:44:23
问题 When I change the orientation of my screen in Android, an OnItemSelectedListener from a Spinner is called. It's not just the emulator, it also happens on a physical phone. How can I stop this from occurring? Cheers. 回答1: Spinners are always selected. Your OnItemSelectedListener will be called when there is any change in the state of the Spinner , including when the Spinner is first set up. A normal orientation change will result in your activity being destroyed and recreated. So, if your

Android, spinner items not showing

爷,独闯天下 提交于 2019-12-11 06:28:14
问题 This is my code and I can not get the items add inside Spinner. I don't know what's going wrong, and unable to find any other way! Java: spinner = (Spinner)getView().findViewById(R.id.spinner); String[] datos = getResources().getStringArray(R.array.items); ArrayAdapter<String> adaptador = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, datos); adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adaptador); XML:

Android editable spinner plus virtual keyboard - is it possible?

橙三吉。 提交于 2019-12-11 05:58:37
问题 I have AlertDialog with an editable Spinner which allows me to edit the selected value, but there is a problem. The edit control inside my Spinner accepts the focus after tap and if the device has a physical keyboard all is fine. But if no keyboard... The virtual keyboard never shows up with this dialog. Even if I force the keyboard to come up after dialog shows (without opening the spinner list), it comes in the background only and it is unusable. Is it possible to have such a dialog with