android-spinner

Show Drop down list below clicked view

空扰寡人 提交于 2020-01-01 17:56:33
问题 How Do i make this view. I checked Spinner and PopUp window but i failed to do... Please suggest me any examples... 回答1: you should go for Android QuickAction widget. This is an open source project of GithUb. https://github.com/lorensiuswlt/NewQuickAction3D https://github.com/alhneiti/Android-QuickAction Hope this will help you. 回答2: I have achived this kind of behavior using a PopUpWindow , here is my code: // The method that displays the popup. private void showStatusPopup(final Activity

ignore OnItemSelectedListener firing on create

[亡魂溺海] 提交于 2020-01-01 07:59:08
问题 I'm creating a spinner and I've added an OnItemSelectedListener to it. However I've noticed that it fires on create. Now I was wondering if there was a way to ignore/discard it. I know I could use a boolean value, but that's a bit "dirty". 回答1: Here is my solution. I need to ignore the first item selection event because there is a dependency between the Route Grade Spinner and the Route Checkbox. And all my controls are setup based on a previous visit to the activity. // Used to count the

how to set spinner selection by text inside it

强颜欢笑 提交于 2020-01-01 04:51:28
问题 I preparing a form in which i have to use same page for Adding details and Editing details. While adding details all fields will be blank and spinner selection will be set to "no selection". Now i want to set the spinner selection of the item which i am going to pass from the previous activity. How to achieve this ?? As spinner does not have any method something like, setSelection(String string); Or is there any other way, i can achieve this mechanism... Would anyone please help me... 回答1:

Android spinner prompt

早过忘川 提交于 2020-01-01 04:17:32
问题 I have a problem with android:prompt for a spinner. I used this code in the XML file but it doesn't work: <Spinner android:id="@+id/spinner" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="120dp" android:prompt="@string/club_type"> </Spinner> I also tried to use this code in my main activity but this doesn't work either: spinner.setPrompt("Select club"); While I was using the second case I didn't use android:prompt ; in other words, I tried

I want to list all unique childrens and keys along with values in a spinner firebase [closed]

送分小仙女□ 提交于 2020-01-01 03:42:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 days ago . I have my realtime database as this. Users=>UID=>Medicines=>Date=>Medicine Name :Values I have a spinner ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arrayList); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item); spinner

Spinner performclick() not working

流过昼夜 提交于 2019-12-31 07:13:31
问题 I want the spinner to open up by itself when I run the activity, so I'm using the performClick() method but it's showing this error: Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? What should I do? Here is my code public class FacilityComplaint extends AppCompatActivity implements AdapterView.OnItemSelectedListener { private Spinner spinner1; private static final String[] suggestions = {"Select from

How can I change the background color of a spinner popup?

青春壹個敷衍的年華 提交于 2019-12-30 17:22:08
问题 I'm trying to set the background color of a spinner popup but everything I've tried didn't work properly. This is the spinner control: <Spinner android:id="@+id/myspinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@null" android:drawSelectorOnTop="true" /> When I click on it, it shows a popup with a white background, and I want to change that. The xml line wich I use to populate the popup is: <RelativeLayout xmlns:android="http://schemas

How to use an ArrayAdapter in a Fragment with Kotlin

可紊 提交于 2019-12-30 10:36:26
问题 I am trying to to create a Spinner inside a Fragment but I am getting error in the ArrayAdapter constructor call. I don't know why, but it has a red underline. Other than that, there is no error. When I'm using the same ArrayAdapter in an Activity it works, but in a Fragment , it gives an error. My FirstFragment.kt : class FirstFragment : Fragment() { private var mListener: OnFragmentInteractionListener? = null override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?,

How to re size the Height of the Items in Spinner with multiple choice?

馋奶兔 提交于 2019-12-30 06:58:19
问题 I just showing the spinner with multiple choice based on this stackoverflow answer(see @Destil answer). Here my problem is I can't re size the Height of the items in Spinner with multiple choice. How to re size the Height of each Items? 回答1: As i know, you will have to use a custom adapter, and override the getDropDown and the getView methods. You will be able to customize each item customizing the layout. Well... words are good, example better, try something like that : public class

Show alertDialog with radiobuttons when click a listViewItem

你说的曾经没有我的故事 提交于 2019-12-30 06:25:10
问题 I have a listView with 2 items in it, the 2 items are "seconds" and "minutes" When I press "seconds" I'd like a alertDialogBox to open en show 5,10,15,... seconds. Same when I press minutes Something like this: But I'm having trouble implementing it, because I don't understand very well how it is working. Here is the code I have: import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import