I want to set image as first element in spinner without any text and then other options as text. I have googled a lot but didn't get anything. What I am getting is either image and text with all options or text only.
Related
I have the following layout in my app -
What I want to achieve is the following -
1) The red line - I want to have above the suggestions a hard coded text saying "did you mean" and then the recommended. This text should be replaced when there are 0 characters in the AutoCompleteTextView and say "recent search". How can I do that?
2) The blue line - I want to have an image near each row item - how can I add them?
3) I would like to add a magnifying glass image before the searched text query starts to write. How can I add it?
As stated in the title, I am using AutoCompleteTextView.
You can create custom view for your autocomplete textview and set that view into adapter. custom view contain imageview and textview as you want in horizontal row.
still not getting idea check this Custom view for dropdown
I'm using a custom Spinner in a dialog mode. Each item element has one text. The text in each item line is very short, eg. "A", "AB", "BC", etc. In order to select a line I have to click exactly the text (the background is than changing into blue and the item is selected correctly). When I click outside this short text but in the item line it is not selected. Is it possible to force the selection when I click the item line not exactly the item text?
If you are using a custom spinner then you should be able to access the textview element in the xml for the class.
In this xml, the textview element try changing the property
Android:layout_width="match_parent"
You may also use the padding and margin to adjust the same.
i want to show a image and text on spinner & dont want to see the dropdown, look at the image shown below, like this need to have text and image. i.e image at left side and text at right end. Also we require selection happening on the spinner.
Eg: If i click on setDate the calender should come and chosen date should sit on spinner.
just add following line for disabling spinner:
spinner.setClickable(false);
and for selecting your row you can use following code:
spinner.setSelection(spinnerPosition);
that spinnerPosition is that position that you want.
I have obtained a list of URL and subsequent title from a web service and I would like to show that the list is clickable.
I want to display the title to the users as
title 1 >
title 2 >
title 3 >
I believe the > signs denotes that these titles are clickable and would do something at launch
I have tried setting
android:clickable="true"
and also
android:clickable="true"
but one of these options show > in my list.
I have already implemented the setOnClickListener() and am able to launch URL with that however what I would like to do is display > next to the list to show they are clickable links.
Using the response given I have now managed to show the image.
However as the title is 3-4 lines long but I see the image only on the first line. Is there any android: (settings) which I can set which would allow the image to be aligned right and centre of the list row?
That's not in the default Android behavior.
You can find an image with the same shape, save it as something like link_arrow_right.png in your drawable folder, and use it on the TextViews that display clickable links.
This can be done in two ways:
1) In your layout xml, in your link text view item:
android:drawableRight="#drawable/link_arrow_right"
2) In your code, programatically:
yourTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.link_arrow_right, 0)
I would like to create a spinner which only displays the drop-down arrow and not the selected value and is only the width of the arrow. You can see various examples of this in Android itself e.g. Settings->Display->Brightness (Edit: a commenter has pointed out that this is a DialogPreference, but I would like a similar effect using a spinner).
I have attached to the setOnItemSelectedListener event and set the selected text to null, but this does not decrease the width of the spinner and you can can briefly see the selected text flicker before it is set to null.
How can I do this with the spinner? Is the spinner the correct control to be using in the first place?
Thanks.