How to make Scrollable List of new page when I click Drop down Snipper in Kotlin - android

I want to make List for selecting region when user register on app.
So What I want to implement is if user click drop down menu
I want make it go another new page, not list dropped down below.
New page will have Scrollable list.
And I click this Scrollable list, I need to get this data.
So I guess I need to use RecyclerView to make Scrollable list of new page.
And Each component of RecyclerView should be button. (is that right?)
1) But what I don't know is how to make Dropdown Snipper as Clickable Button.
Snipper can't use setOnClickListener.
Should I make Button to have Text and Arrow manually?
In React Native It had some library for this purpose.
2) Is that correct Kotlin doesn't provide such library?

Related

Customize dropdown (Picker) list in xamarin.forms

I am working on xamarin.forms. I am creating an app for android. In app I have a dropdown list. I am using Picker for it. I customized it to look like dropdown. Now I need to make the first Index item to nonselactable. Means user can not select the first item. If user click on it nothing should happen. But currently when user click on the first index dropdown gets collapsed.
One more thing that I have to add in dropdown is a Cross button at index 1. Means at index 1, on left side there will be Cross button and at center there will be text like Select item. And this whole row should not be selctable. If user click at cross button dropdown should collapsed.
Anyone have idea how I can do this?
You can use listview for dropdown and control its visibility as per need.I faced similar situation where I customized list view to enact dropdown.There is another thing I want to know about Picker.Does your picker accepts or adds string only or you could customize it to accept views or controls?

Android: How to dynamically replace a list view with another list view like Instagram with onClick?

I'm building an android app and I'm trying to replace a list view with another list view if you click a button, like the notifications page on Instagram. On that page, if you click on the top "following" button it will show you a listview of what your followers have liked. If you click on the "you" button it will show you a listview of what people have liked your photos.
Any help would be greatly appreciated!
You can do it by following ways,
1. add Two listviews and can change the visibility as per your requirement.
2. On button click you can load the other data into same list view and can update your adapter in the same list view.
in 1 you have to load two list view at first which will consume more time if data is larger sure you can write a login in asynctask to load list views in background thread.
in 2 you have to update your adapter at the button so you will have to provide some progress bar of dialog for user while you list view is getting update.
You can use either of this whichever suites you best.
Simply , You don't need to switch Listview , you only need to switch adapters .
eg, you can switch to mFollowingAdapter when clicked on Following button and switch to mYouAdapter when you select "You" tab. that's it.
You should write a list, that has a custom adapter. This adapter will be able to display BOTH views you want to display.
If the data to be displayed is the same format (ie. both have an imageview next to a textview), you are in good shape.
When you want to switch to a different list, get the information you would like to display, replace the data in your the collection backing your list, then notify the list that the data has changed, and it should redraw.
So, this might look like:
create ArrayList() with data A
setup List, with this data and display
replace the ArrayList() with data B
call listView.notifyDataSetChanged
You can still do this if the Data A, and Data B have different views, in this case, you would need to handle this logic in your custom adapter.

Android: change titlebar on checkbox click

I have an activity with a RelativeLayout consisting of a ListView. This ListView is populated through a custom ListAdapter. The list displays a checkbox and text for each row.
So far, so good.
I want to implement something like the default android Gmail app, where if I checkbox-select an email, the titlebar of the application at the top changes and presents options relevant to the selection (such as delete, move, archive, etc). I am not sure what to look for in the Android documentation.
Do I just create some layout above the ListView and dynamically add elements(like delete row, etc) to it on a checkbox click? Any help is appreciated!
if you have used ActionBarSherlock then you can use Action mode menu to show various option to user when checkbox is selected from listview
or
you can try
http://java.dzone.com/articles/contextual-action-bar-cab

how to create view that expand & shrink on click?

I have to display list of items along with a plus(+) sign , on click of plus sign list should expand & on click again list should shrink
You can do this but would need to do more work
as you want to show
name ,address and plus sign should changed to minus ,
you would require to make a custom list view and what you can do is use
when plus button is clicked in list
nameText.setVisibility(View.VISIBLE);
adress.setVisibility(View.VISIBLE);
btn.setBackgroundResource(R.drawable.minus);
and when minus button is clicked
nameText.setVisibility(View.GONE);
adress.setVisibility(View.GONE);
btn.setBackgroundResource(R.drawable.plus);
If you want to create a tree view like windows, then it is not a UI element that is supported by android. The similar to this is the ExplandableListView element.
Although in one business application I have found this http://code.google.com/p/tree-view-list-android/ project that does exactly what you want.

How to display "More" list item in ListView?

I want to display a list item that says "More" at the end of my ListView. Clicking on this list-item will perform some action. How can I create this "more" list item?
I don't know about the "Clicking on this list-item will perform some action" part. The typical pattern is that once the user scrolls to the bottom, new material is loaded automatically. Some people do that by detecting the scroll. I do it by putting in a "More" placeholder and detecting when that is used. Here is a component that implements this pattern.
Just add another value to your arrayadapter (or any other adapter), you might be using.set the text to 'more' .
Suppose you have n items in the list then handle the (n+1)th postion click and do your stuff.
You can add a footer to your listview...
Did you check this post out?
Android ListView Footer View not being placed on the bottom of the screen

Categories

Resources