android-spinner

How to open two spinners at a time in android?

两盒软妹~` 提交于 2020-01-16 18:23:06
问题 I know how to work with single spinner. I'am populating one spinner with kilograms and other with grams. I have to open two spinners at a time (one beside other) on click of a button/view. User should be able to scroll through items of spinners individually and select kilograms & grams at one shot. How can i do it? Please help me. 回答1: You probably want to use a custom View for that. Have a look at this project. I use it in my current project, and it's excellent. 来源: https://stackoverflow.com

Android: change color of spinner's popup scrollbar

喜欢而已 提交于 2020-01-16 04:14:25
问题 How can I change the color of the spinner's popup scrollbar? For some reason the color of the scrollbar is currently white on a white background, it is not visible. 回答1: add android:scrollbarThumbVertical="@drawable/yourdawable //in your spinner yourdrawable.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="your color" android:endColor="your color" android:angle="45"/> <corners android:radius="6dp" /> <

Android Spinner Set dropdown text direction to RTL

青春壹個敷衍的年華 提交于 2020-01-15 10:25:27
问题 How to set spinner dropdown text direction to rtl ? I know for regular texts we can use android:textDirection="rtl" but it does not work for spinner dropdown text. Should I implement it in popup theme? How? Thanks 回答1: Try This - Add below code in Activity Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, // android.R.layout.simple_spinner_item); R.layout.textview); // adapter

selected item on spinner won't work (ANDROID)

房东的猫 提交于 2020-01-15 09:28:08
问题 My data comes from Firebase database. I successfully populated the busNum to the spinner . But my problem is whenever I got to select the busnum , nothing shows up on my spinner . Here are some of codes. List<String> busnum = new ArrayList<String>(); busRef = new Firebase(Config.FIREBASE_URL_BUSNUMBER); busRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {

How to use SparseArray as a source for Adapter?

此生再无相见时 提交于 2020-01-14 09:35:08
问题 I have a sparse array of values which I want to populate in a Spinner, and when the item is selected, I want to get the id (which is the key from the sparse array). What is the preferred way of creating an adapter from a SparseArray? Is it possible to subclass an existing Adapter like BaseAdapter or ListAdapter So that the items will have a key from the SparseArray as item id? Not knowing how to achieve the above, I am thinking of creating a simple ArrayAdapter instance and giving it values

Create android spinner dynamically in Xamarin

佐手、 提交于 2020-01-13 02:44:09
问题 I'm a newbie to Xamarin and I want to create a simple application to get familiar with Xamarin. I want to create and populate the spinner and display it's options dynamically. I have seen the documentation here but it is not created programmatically. Any help will be apreaciated var levels = new List<String>() { "Easy", "Medium", "Hard", "Multiplayer" }; var adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleSpinnerItem, levels); adapter.SetDropDownViewResource(Android

Why is Android recycling the wrong view type in my SpinnerAdapter?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-12 07:29:13
问题 I'm trying to make an ActionBar spinner that has separators. I have implemented a SpinnerAdapter that has 2 item view types (thanks to getViewTypeCount ). The problem is that I'm being sent some convertViews from the other type. Here's my SpinnerAdapter: public abstract class SeparatorSpinnerAdapter implements SpinnerAdapter { Context mContext; List<Object> mData; int mSeparatorLayoutResId, mActionBarItemLayoutResId, mDropDownItemLayoutResId, mTextViewResId; public static class

How to let the Spinner items appear below itself when being clicked and with full width, like on G+ app

雨燕双飞 提交于 2020-01-11 04:58:05
问题 background Google plus has a spinner-like view that shows a lot of items, but all of them appear below itself: I need to mimic this in my own spinner (that's what I was told), but as of recently, Material-Design guidelines say (here) the Spinner should put its items on top of itself, and that's what the support library does for it. The problem I can't find a way to revert this behavior. I've tried changing the style of the Spinner, and also searched about this on the Internet (and here). The

How to create android spinner without down triangle on the right side of the widget with bottom line

笑着哭i 提交于 2020-01-07 03:15:19
问题 I want to remove down triangle on the right side and wants to bottom line. I am using following code to add bottom line: <Spinner android:id="@+id/buttonSelectCountry" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:gravity="center" android:spinnerMode="dropdown" android:text="Select country" style="@style/Widget.AppCompat.Spinner.Underlined"/> and following code to remove down arrow: <Spinner android:id="@+id

Mono for Android: Spinner within a listview

一世执手 提交于 2020-01-06 19:39:09
问题 I have a listview which is populated from a webservice using an ArrayAdapter. The webservice provides me with all the data I need. Some are just plain textviews yet other alternate between EditText and spinners. I show them easily, also filling up the values where they're due in EditText fields. The problem comes with filling up the value of the Spinner. Can I define an adapter within an adapter? Also my data comes from a webservice as an XML passed as a string. My Spinner code so far inside