Posts

Showing posts with the label spinner

Styling Spinner gives duplicates

Image
Styling Spinner gives duplicates Above is my desired output for the spinner, but with transparent bg. <style name="spinnerStyle"> <item name="android:textColor">@android:color/white</item> <item name="android:background">@android:color/transparent</item> </style> Above gives transparency to only when spinner is not selected. I tried setting popupBackground to transparent but gives me the below result with duplicate item and also weird spacing. popupBackground Is there any way to just make the bg transparent in the first output easily? Thanks. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Adding new element(s) to Spinner Adapter

Adding new element(s) to Spinner Adapter I'm new to Kotlin language and I'm going to load Spinner data from the website. For this reason, I used Fuel Library as my httpGet , httpPost and ... helper library and simply the Spinner Control for showing that data to the user. Below is my tried code: Kotlin Spinner httpGet httpPost Spinner var listOfLesson:List<String> = listOf() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.ostad_page) val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, listOfLesson) "home/GetAllLessons".httpGet().responseString { request, response, result -> when (result) { is Result.Success -> { val lessonsArray: List<tblLesson> = Gson().fromJson(result.value, Array<tblLesson>::class.java).toList() var index:Int = 0 for (lesson: tblLesso...