http://www.coderzheaven.com/2011/07/18/customizing-a-spinner-in-android/
In this example above, before an item is selected it shows text and dropdown arrow on the right. When the user clicks it (displaymode = dropdown?) it shows the prompt with an arrow as well. This is the behavior I want my customer spinner to do, but it's not. Primarily I want the spinner to load with wtih the normal dropdown arrow as first item. The prmpt issue I can at least get text to appear if i set displaymode=dialog on the spinner. For this post I mostly would like to get the default item issue resolved first...
Info:
I do not have android theme on my app. My parent systel is AppTheme butno parent above that. I have custom spinner like so:
List<LanguageSelection> nativeLanguagesData = getSupportedLanguageList();
LanguageSelectionListAdapter nativeAdapter = new LanguageSelectionListAdapter (this, R.layout.fragment_language_selection, nativeLanguagesData);
nativeAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
Spinner uxNativeLanguageSpinner = (Spinner)findViewById(R.id.uxNativeLanguageSpinner);
uxNativeLanguageSpinner.setAdapter(nativeAdapter);
and for xml:
<Spinner android:id="#+id/uxNativeLanguageSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:padding="0dp"
android:spinnerMode="dropdown"
android:prompt="#string/status_prompt"
android:layout_below="#id/uxNativeLanguageSelectLabel"
android:popupBackground="#android:color/transparent" />
Attached is what appears. I've scoured the internet trying to figure out why this thing doesn't show first item with arrow. I also have the android simple_spinner_dropdown_item.xml in my code base instead of referencing andorid.r.*. Any ideas? I'd like to get rid of my ugly label just above the spinner indicating the user needs to select something and instead use the common dropdown arrow on the first item. Just doesn't show when I create a custom spinner though. Again, the items in the list appear correctly it's just that i want the first item be something like in the link at the top where there is Select and iten and down arrow icon to the right indicating it's dropdown.
[http://tinypic.com/r/2r7927o/5][1]
And this is image link below shows exactly what I'm talking about. I circled in red the dropdown arrow I want to appear. I want my list to appear just like this and it except for the dropdown arrow. The actual list of items when clicked appear just fine...
tinypic.com/r/2ekj6mv/5 (sorry, can't hyperlink because i need 10 reps to post two links)
Related
I have android listview with custom adapter.I have implemented the AdapterView.OnItemClickListener . Onclick it launches a new fragment. Now all of that works, but the listview Item turns grey after click in the background.I need it to be transparent/white.
So I thought it must be in a selected state which I somehow have to disable.
This is what I have tried so far without any luck.
listview.setSelector(android.R.color.transparent);
listView.setFocusable(false);
listView.setActivated(false);
Other options such as
in onItemClick(){
view.setBackgroundColor(ContextCompat.getColor(getContext(),
android.R.color.transparent));
interesting this seems to be semi working as if I use color.red. I can see it getting red momentarily before the fragment dialog shows at that point I can see it turning grey again in the background.
Also the odd part is that this last piece of code i.e
view.setBackgroundColor(ContextCompat.getColor(getContext(),
android.R.color.transparent)
works in onItemLongPress. And it stays transparent as expected.
How can i get the text selected on one tap from a textview. I want user to have cursor to modify the automatic selection. It's fine if it's easy with edittext, i can make it non-editable.
There shouldn't be any contextual menu. Though there are solutions available but it's not complete and clear. Like when to use spannable, disabling contextual menus.
I am using Basic4Android as my programming language and I am trying to display the popup menu using the AHQuickAction library. (v1.01)
I am trying to make it when you tap on a label make it display the popup menu.
I am using the following code (which displays the popup menu)
Sub lblTest_Click
Dim lbl As Label
lbl = Sender
ac1.show(Sender)
End Sub
however, it always displays the popup under the item I taped on.
As shown in the image below I taped on the last item in the list (Test 19) and the popup is displaying on top of the item I taped on and looks like I taped on Test 17.
is there a way to display the correct item I taped on ?
I have attached the code as a zip so you can see what I mean and you might be able to tell me what I am missing. - My Example Code
In the example code, run the app on your device and tap on the label on the left in the app. You will find that it always displays under the item you tap on, where if there is space above the item you tapped on it never displays there.
Hope someone can help me out.
I want to use/create a button that works like the one on the (HTC Desire) Soft Keyboard.
So that when you make a long click, it will show a list of options, and by sliding your finger to the left or right, you select which option you want to choose.
Example: When I hold down the "12#" button on the keyboard, it presents the
list: [: / # _ - ! ? '], and by sliding left or right it highlights one of these characters and chooses the selected one when I release my finger. If I just click normally, it selects the default character.
Is there such a widget in the Android SDK, or can anyone give a hint on how to implement such a component.
See screenshot: Entering text, and just long pressed the "12#" button. "!" is currently selected.
Create a custom Activity with android:theme="#android:style/Theme.Dialog" (this will give it a transparent, floating dialog look).
Add to it a LinearLayout with android:orientation="horizontal"
Add some button with icons to LinearLayout. This creates a transparent Button with an Icon and some text beneath it:
<Button android:id="#+id/optionsButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:text="#string/button_options_text"
android:textColor="#color/button_text_grey"
android:drawableTop="#drawable/button_options"
android:drawablePadding="-5dip"
android:background="#null"
Use Button.onKeyLongPress(..) to show this Activity.
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?
The Spinner doesn't gray out when disabled, it's a bug that we fixed in FroYo (next version of Android.)
Further to setting as disabled, I don't know any other way to grey out.
Hide the second spinner until the first has no selection.
Or until it's in disabled state, the first visible option should show text related to the required selection eg: Select a Continent first