(Mobile App Development)(Android Studio Assignment) Create a tab view, which has
ID: 3916287 • Letter: #
Question
(Mobile App Development)(Android Studio Assignment)
Create a tab view, which has Tab A and Tab B. Tab A is empty, but Tab B contains a spinner that has a drop-down function on it. Place a scrollbar inside the dropdown of the spinner. The categories inside the spinner include vegetable, fruit, meat, drink. Clicking on each section will pop up a fragment section below. Here, I clicked on the vegetable section, which leads me to a page displaying vegetables and their expiration dates.
Note: Post XML and Java codes for both the main activity and the fragments. You only need to create the vegetable fragment, I will code the rest based on the vegetable fragment. Do not screenshot/write on paper the code, just copy and paste the code from your Android Studio. Please TEST the code out before posting the XML and Java Codes for both the main activity and the fragments.
Note 2: Do not use your own IMPORTS for this, as I do not understand where these IMPORTS come from. An example of this would be like your companydomain.adapter.VegRecAdapter, companydomain.adapter.Vegetable; and, companydomain.adapter.ViewPagerAdapter;. DO THIS ASSIGNMENT WITHOUT USING ANY SORT OF IMPORTS OF YOUR OWN. MAKE SURE TO POST ALL OF YOUR CODES IF YOUR USING COLOR.xml and STRING.XML as well.
Tab A Tab B Choose a category: 1Explanation / Answer
Spinner does not have a scrollbar.
The popup shown by spinner has a scrollbar. So you need to change the properties of the ListView shown by spinner. But ListView itself is not exposed by Spinner by any public methods.
Even if you get the ListPopupWindow by reflection, a further problem arises, that ListPopupWindow's ListView is only created after you click the Spinner.
But OnClickListener of the Spinner cannot be registered , to set the ListView Properties after the show.
You could create a Custom Spinner with performClick overridden and then get mPopup by reflection. and use mPopup.getListView().setScrollbarFadingEnabled(false)
But If you are going to create a custom Spinner, i believe it is easier to implement the whole popup to suit your needs than using reflection.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.