chivorns / smartmaterialspinner Goto Github PK
View Code? Open in Web Editor NEWThe powerful android spinner library for your application
Home Page: https://github.com/Chivorns/SmartMaterialSpinner
License: Other
The powerful android spinner library for your application
Home Page: https://github.com/Chivorns/SmartMaterialSpinner
License: Other
we just want to give margin to dismiss button on the right side
so that button will be look awesome and cool
I'm curious about this line of code (highlighted)
and see the implementation of hint
will never be null, because you were always using ""
a blanks/empty strings.
both in setter line 1106 and 256
thus the code:
SmartMaterialSpinner.super.setSelection(hint != null ? finalPosition + 1 : finalPosition, false);
will always having a finalPosition + 1
means the index/position == item.size, IndexOutOfBoundsExceptions
occurred
IMHO the rest of the nullability check will having a false-positive instead
cmiiw
I'm curious why this widget cannot support android:entries, but it would be wonderfully easy if you would add this
<com.google.android.material.textfield.TextInputLayout
android:hint="@string/hint_test"
...
/>
<string name="hint_test">Legal name <font color='#FF0000'>*</font></string>
Above code generates hint label with red * but in this library using same hint label * shows but color doesn't.
especially when searchable, the inputted text is white with a white background
spinner.setSelection(0)
spinner.onItemSelectedListener = (object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long ) { //Toast } } override fun onNothingSelected(parent: AdapterView<*>?) { } })
Toast is shown without Item Click inside onCreate() method
I have find that SetSelection() method use Runable to select while your listener is registered and OnItemSelected() called by the listener because of SetSelection() delay.
I use the spinner inside a Fragment. When i choose an item from the list i navigate to another Fragment. I want to load the last state when i get back to the initial Fragment. Is there any method to load a specific item from the list programmatically?
Does it support full RTL?
I think the drop down arrow is drawn on the opposite side.
Hello! smsp_itemSize
changes item size only on the item selection? How I change the text size of item inside the spinner? Sorry, if I missed this, but I couldn't seem to find it in the description.
If I want to validate that nothing has been selected (hint) with this method it doesn't work.
How should I implement it?
please show How to make the Spinner Hint Bold
See https://material.io/components/menus#exposed-dropdown-menu
There are two new designs with background and with rounded outline. To mix and match with other material components it's necessary to support new spinner designs
how to use onSearchItemSelected data from api ?
affter i choose a value in Search mode, it not showing in my spiner .. thank you
In my project we are using all boxed edit texts.
To be in sync with theme,
We have to use outlined boarder instead of filled box.
how to change item Text size ?
hi , thanks for great component
is there anyway to set radius to list of spinner ?!
Steps to reproduce:
select an item in code using spinner.setSelection(position)
click on spinner for selecting item(spinner starts scrolling), in that moment you should start typing something in search.
Also, count of items ~1500
Logs
java.lang.IndexOutOfBoundsException: setSpan (-1 ... 1) starts before 0 at android.text.SpannableStringInternal.checkRange(SpannableStringInternal.java:496) at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:196) at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:183) at android.text.SpannableString.setSpan(SpannableString.java:60) at com.chivorn.smartmaterialspinner.SearchableSpinnerDialog$1.getView(SearchableSpinnerDialog.java:209) at android.widget.AbsListView.obtainView(AbsListView.java:2494) at android.widget.HwAbsListView.obtainView(HwAbsListView.java:1139) at android.widget.ListView.makeAndAddView(ListView.java:2119) at android.widget.ListView.fillDown(ListView.java:815) at android.widget.ListView.fillGap(ListView.java:776) at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5646) at android.widget.ListView.trackMotionScroll(ListView.java:2013) at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:5152) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1057) at android.view.Choreographer.doCallbacks(Choreographer.java:875) at android.view.Choreographer.doFrame(Choreographer.java:772) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1042) at android.os.Handler.handleCallback(Handler.java:888) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:8178) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
how to apply custom font. . ?
Does it support clearing the selection, e.g. after the spinner is closed and reopened again or has a pre-selected value?
I would like to know, If it's possible to remove the hint text after choose the item in the spinner list?
Hello.
Is there a way to prevent keyboard from opening right after searchable spinner is shown? I would like it to be shown when user manually clicks in the search field
list items not appear when content in arabic.
when clicked , there is a "Select Item" above the list, how can I remove it ?
To reproduce the issue, set a list of items on a searchable SmartMaterialSpinner, then select the first one. The first item in the list is highlighted, since it is selected. Begin to search the list by typing a single character in the search input, and the list updates due to the search filter. However, after doing so, the first item in the list is still highlighted, even though it is not currently the actual selected item. It only seems to care about the index of the selected item from before the search input.
How to clear selection ?
Hi
I need Searchable spinnerMode is dropdown,now Searchable spinnerMode is dialog
This is my logcat
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.key.myapplication, PID: 23896
java.lang.ArrayIndexOutOfBoundsException: length=10; index=-2
at java.util.ArrayList.get(ArrayList.java:439)
at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:385)
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:441)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:407)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner$HintAdapter.buildView(SmartMaterialSpinner.java:1672)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner$HintAdapter.getView(SmartMaterialSpinner.java:1646)
at android.widget.Spinner.makeView(Spinner.java:712)
at android.widget.Spinner.layout(Spinner.java:660)
at android.widget.Spinner.onLayout(Spinner.java:622)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:761)
at android.view.View.layout(View.java:19659)
at android.view.ViewGroup.layout(ViewGroup.java:6075)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
We are using this spinner inside an Android Fragment
. I noticed the app crashing when you attempt to click the searchable spinner after orientation changes.
Steps to reproduce
Create the spinner that allows you to search its items within a fragment
Change the screen orientation to LANDSCAPE then revert back to PORTRAIT
Click the spinner
Logs
java.lang.IllegalStateException: FragmentManager has been destroyed
at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1723)
at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:321)
at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:286)
at androidx.fragment.app.DialogFragment.show(DialogFragment.java:175)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner.performClick(SmartMaterialSpinner.java:763)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner.onTouchEvent(SmartMaterialSpinner.java:738)
at android.view.View.dispatchTouchEvent(View.java:13415)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3054)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2741)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner.dispatchTouchEvent(SmartMaterialSpinner.java:731)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:465)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1849)
at android.app.Activity.dispatchTouchEvent(Activity.java:3993)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:423)
at android.view.View.dispatchPointerEvent(View.java:13674)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5482)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5285)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4841)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4807)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4947)
https://choosealicense.com/no-permission/
please go to this link and and an appropriate License type to this repository
thanks for your awesome contribution ...!
how can i disable touch/click event to pop up dropdown/dialog itemsview
i've tried setEnabled(false) and setClickable(false) but no luck
I am using Android Studio 4.1 with targetSDKVersion 30
I am getting a lint check message of:
Raw use of parameterized class 'SmartMaterialSpinner'
Class SmartMaterialSpinner
java.lang.Object
AppCompatSpinner
com.chivorn.smartmaterialspinner.SmartMaterialSpinner
When I use the following code:
private int getIndex(SmartMaterialSpinner spinner, String item) {
int index = -1;
for (int i = 0; i < spinner.getCount(); i++) {
if (spinner.getItemAtPosition(i).equals(item)) {
index = i;
break;
}
}
return index;
}
The warning highlights "SmartMaterialSpinner"
Am I doing something wrong or is it Android Studio that is giving me a false warning?
Caused by: java.lang.RuntimeException: Font asset not found fonts/hinted_cello_sans_light.ttf
at android.graphics.Typeface.createFromAsset(Typeface.java:839)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner.initAttributes(SmartMaterialSpinner.java:276)
at com.chivorn.smartmaterialspinner.SmartMaterialSpinner.init(SmartMaterialSpinner.java:247)
spinner populates only one data of the array in the spinner .. how do i resolve it? thanks
Button is aligned to the end without margin.
Can you set a default margin?
when drop down is populated how to hide the top hint from the drop down
hi
how to set hint right to left?
How can i use a array list of objects to bind with this library
Hello,
i found two issues while using this library
Thnaks.
Currently, my background and text colors of my search box are white. How to change it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.