I have spinner items showing like this
On 4.1+ My AutoCOmpleteTextView shows the same. However in 5.0+ the AutoCompleteTextView shows white dropdown where spinner shows the same Black as above.
How can i set AutoCompleteTextView to show old black,
Something
spUniversity.setDropDownBackgroundResource()
What resource to put here.
You can style your AutoCompleteTextView
Check it here.
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dropDownSelector="#drawable/list_selector" />
What i did was went to android sdk resources and get the standard spinner background and replaced it with popupbackground.
Related
I want to adjust my spinner like Google android translate
I want to adjust my left spinner text like the right image, below the given code is my left side spinner
<Spinner
android:id="#+id/idFromSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_marginStart="-3dp"
android:paddingEnd="30dp"
android:paddingStart="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
Please help me in this project actually my task is to make a spinner like Google translate
I want to make left spinner left side and right spinner right side margin fix it should not change on increasing or decreasing text length
You can add in android:layout_marginRight="10dp". Just adjust " 10dp" time and time again, good luck on that spinner!
Edit:
The solution is a good use if the left-side spinner is android:layout_toLeftOf="#+id/middle_switcher but if not. You could just use any other Layouts like the GridLayout...
I have created a custom toolbar (custom_ttolbar.xml) that I am adding it to my activity. I want to change the search icon in the toolbar to white and the text to be entered to be white how can I do that ?
Here how it look.
and here is the xml code for the search view:
<SearchView
android:layout_alignParentEnd="true"
android:id="#+id/simpleSearchView"
android:layout_height="30dp"
style="#style/MySearchViewStyle"
android:layout_width="wrap_content"/>
Also, the text entered when I click the search button is black how do I change that also ?
for the search bar, you can use the following code:
android:goIcon="#drawable/your_go_icon"
android:iconifiedByDefault="false"
android:queryHint="your_hint"
android:searchIcon="#drawable/your_search_icon"
You can use any icon of your choice (white or otherwise) in the android:searchIcon property.
For the text color, I suggest you follow https://stackoverflow.com/a/40550067/8190327
I have an android app where it has two list views in same screen. With one ListView i can get right result(I can highlight the pressed item). If i set the Adapter of the second ListView with setOnItemClick() method of first Listview, my first Listview's setSelected() method don't working. Can anyone help me?
And I also have *.xml files for state_selected tags. I want to highlight only one selected item and not multiple items.
If you just need to change the color of the currently selected item in the ListView, just use change choiceMode attribute to "singleChoice", and select the color using listSelector attribute
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:choiceMode="singleChoice"
android:listSelector="#android:color/darker_gray"
/>
I'm trying to make a simple app in android studio but running into trouble with layout whenever I place down a RadioGroup. In my first image here I've created a RadioGroupand dragged two RadioButtons into it by dragging them to the radiogroup option on the component tree trying to drop them into the radiogroup on the layout thing is impossible as the radiogroup is completely invisible on it.
I drag a button below it, lining it up with the center, and the box that shows where the buttons going to go shows it being below the radiogroup. But once I release the mouse button, the button im attempting to place ends up here.
I've been fighting with android studio for a while now but if I get the button even remotely close to the RadioGroup it gets catapulted up the screen, and I don't have enough room if I place the button way down low for my other elements.
tl;dr
radiogroups are catapulting any elements underneath them above them. its probably a layout or gravity issue or something like that. but I don't know how to fix it and would like my buttons to not be underneath all the other elements kthx.
I'm not sure what is causing your issue, because you aren't providing enough information. But If you want the button to appear under your radio group, then in your xml file, give your radio group an id android:id="#+id/radioGroup" and in your button add android:layout_below="#id/radioGroup".
Try to android:layout_below="#+id/radioGroup" in your button.As your are using Relative Layout by default it takes you top while dragging.Here is full Button view.
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:id="#+id/button"
android:layout_below="#+id/yourRadioGroupId"
android:layout_centerHorizontal="true" />
I have been working on an Android app and I want to display a multicolumn ListView in Android showing text, image and Radio button. Though I have been reading few blogs which offered me choice to use GridView instead or Multiple ListViews,I am still in doubt what shall i use.
Can anyone give me a hint on how to implement the same. May be some references be helpful too.
for multiple column into listview you need to customize the listview and need to create you layout that you have mention
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
android:orientation="horizontal">
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="#+id/list_item_text" android:text="item text" android:weight="1"/>
<ImageView android:layout_width="50dp" android:layout_height="50dp" android:id="#+id/list_image" />
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
you custom view code like this but in this for radio button you have to check the by coding and to maintain the radio button state for your list. Because in listview 1 row has only 1 radio button so you cannot maintain with the radio group button.
now you need to create the custom adapter ok here is the link for listview check this how you can create your custom adapter
Create a ListAdapter subclass and override the getView() method to return a custom view that contains the elements you need.